Compare commits
2 Commits
ea2e633d7d
...
5fbff13428
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fbff13428 | |||
| 7a23ee5bc0 |
@@ -19,7 +19,7 @@ use crate::app::{
|
|||||||
clipboard::Clipboard,
|
clipboard::Clipboard,
|
||||||
error_msg::StatusMessage,
|
error_msg::StatusMessage,
|
||||||
logic::{
|
logic::{
|
||||||
calc::{Grid, get_header_size},
|
calc::{Grid, LEN, get_header_size},
|
||||||
cell::CellType,
|
cell::CellType,
|
||||||
},
|
},
|
||||||
mode::Mode,
|
mode::Mode,
|
||||||
@@ -124,6 +124,11 @@ impl Widget for &App {
|
|||||||
y_idx = y as usize - 1 + self.screen.scroll_y();
|
y_idx = y as usize - 1 + self.screen.scroll_y();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't render non-accessible cells
|
||||||
|
if x_idx > LEN-1 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const ORANGE1: Color = Color::Rgb(200, 160, 0);
|
const ORANGE1: Color = Color::Rgb(200, 160, 0);
|
||||||
const ORANGE2: Color = Color::Rgb(180, 130, 0);
|
const ORANGE2: Color = Color::Rgb(180, 130, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -273,13 +273,13 @@ impl Mode {
|
|||||||
// Go to end of row
|
// Go to end of row
|
||||||
'$' => {
|
'$' => {
|
||||||
let (_, y) = app.grid.cursor();
|
let (_, y) = app.grid.cursor();
|
||||||
app.grid.mv_cursor_to(super::logic::calc::LEN, y);
|
app.grid.mv_cursor_to(super::logic::calc::LEN-1, y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Go to bottom of column
|
// Go to bottom of column
|
||||||
'G' => {
|
'G' => {
|
||||||
let (x, _) = app.grid.cursor();
|
let (x, _) = app.grid.cursor();
|
||||||
app.grid.mv_cursor_to(x, super::logic::calc::LEN);
|
app.grid.mv_cursor_to(x, super::logic::calc::LEN-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// edit cell
|
// edit cell
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::{collections::HashMap, sync::RwLock};
|
use std::{cmp::min, collections::HashMap, sync::RwLock};
|
||||||
|
|
||||||
use ratatui::prelude;
|
use ratatui::prelude;
|
||||||
|
|
||||||
@@ -123,22 +123,12 @@ impl ScreenSpace {
|
|||||||
l.1 = area.height as usize;
|
l.1 = area.height as usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let width = (area.width as usize + calc::get_header_size() -1) / self.get_cell_width(vars);
|
let width = (area.width as usize / self.get_cell_width(vars)) + 1;
|
||||||
let width = area.width as usize / self.get_cell_width(vars);
|
|
||||||
let height = area.height as usize / self.get_cell_height(vars);
|
let height = area.height as usize / self.get_cell_height(vars);
|
||||||
|
|
||||||
let x_max =
|
let x_max = min(LEN-1, width);
|
||||||
if width > LEN {
|
let y_max = min(LEN-1, height);
|
||||||
LEN - 1
|
|
||||||
} else {
|
|
||||||
width
|
|
||||||
};
|
|
||||||
let y_max =
|
|
||||||
if height > LEN {
|
|
||||||
LEN - 1
|
|
||||||
} else {
|
|
||||||
height
|
|
||||||
};
|
|
||||||
(x_max as u16, y_max as u16)
|
(x_max as u16, y_max as u16)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user