@@ -1444,7 +1444,7 @@ impl Shell {
1444
1444
fn display_content_slice ( & mut self ) -> Result < ( ) , & ' static str > {
1445
1445
// Calculate the last line to display. Make sure we don't extend over the end of the file.
1446
1446
let ( _width, height) = self . terminal . lock ( ) . get_text_dimensions ( ) ;
1447
- let mut line_end: usize = self . line_start + ( height) - 5 ;
1447
+ let mut line_end: usize = self . line_start + ( height - 20 ) ;
1448
1448
1449
1449
if line_end > self . map . len ( ) {
1450
1450
line_end = self . map . len ( ) ;
@@ -1472,9 +1472,7 @@ impl Shell {
1472
1472
/// for each line. It stores index of each starting and ending char position of each line (separated by '\n)
1473
1473
fn parse_content ( & mut self ) {
1474
1474
// Get the width and height of the terminal screen.
1475
- let ( width, height) = self . terminal . lock ( ) . get_text_dimensions ( ) ;
1476
-
1477
- self . terminal . lock ( ) . print_to_terminal ( format ! ( "{} {}\n " , width, height) . to_string ( ) ) ;
1475
+ let ( width, _) = self . terminal . lock ( ) . get_text_dimensions ( ) ;
1478
1476
1479
1477
// Number of the current line.
1480
1478
let mut cur_line_num: usize = 0 ;
@@ -1510,7 +1508,6 @@ impl Shell {
1510
1508
fn get_content_string ( & mut self , file_path : String ) {
1511
1509
let Ok ( curr_wd) = task:: with_current_task ( |t| t. get_env ( ) . lock ( ) . working_dir . clone ( ) ) else {
1512
1510
self . terminal . lock ( ) . print_to_terminal ( "failed to get current task" . to_string ( ) ) ;
1513
- return ;
1514
1511
} ;
1515
1512
1516
1513
let curr_dir = self . env . lock ( ) . working_dir . lock ( ) . get_absolute_path ( ) ;
@@ -1525,7 +1522,6 @@ impl Shell {
1525
1522
// Checks if it is a directory
1526
1523
FileOrDir :: Dir ( directory) => {
1527
1524
self . terminal . lock ( ) . print_to_terminal ( format ! ( "{:?} a directory, cannot 'less' non-files." , directory. lock( ) . get_name( ) ) ) ;
1528
- return ;
1529
1525
}
1530
1526
// Checks if it is a file and reads it into a utf8 string
1531
1527
FileOrDir :: File ( file) => {
@@ -1534,13 +1530,11 @@ impl Shell {
1534
1530
let mut string_slice_as_bytes = vec ! [ 0 ; file_size] ;
1535
1531
if let Err ( _e) = file_locked. read_at ( & mut string_slice_as_bytes, 0 ) {
1536
1532
self . terminal . lock ( ) . print_to_terminal ( "Failed to read error" . to_string ( ) ) ;
1537
- return ;
1538
1533
}
1539
1534
let read_string = match str:: from_utf8 ( & string_slice_as_bytes) {
1540
1535
Ok ( string_slice) => string_slice,
1541
1536
Err ( _utf8_err) => {
1542
1537
self . terminal . lock ( ) . print_to_terminal ( "File was not a printable UTF-8 text file" . to_string ( ) ) ;
1543
- return ;
1544
1538
}
1545
1539
} ;
1546
1540
// Stores the content of the file as a string
0 commit comments