Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/app/linux_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,16 @@ static void mouseButtonCallback(GLFWwindow* w, int button, int action, int mods)
row -= g_grid_top_offset;
if (row < 0) row = 0;

// Clamp to focused pane bounds when splits are active
if (g_split_active && g_pane_rect_rows > 0) {
int pr = g_pane_rect_row, pc = g_pane_rect_col;
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
Comment on lines +741 to +746
}

// Ctrl+click opens hyperlink
if (mods & GLFW_MOD_CONTROL) {
int cols = g_cols, nrows = g_rows;
Expand Down Expand Up @@ -982,6 +992,17 @@ static void cursorPosCallback(GLFWwindow* w, double mx, double my) {
mouseToCell(mx, my, &col, &row);
row -= g_grid_top_offset;
if (row < 0) row = 0;

// Clamp to focused pane bounds when splits are active
if (g_split_active && g_pane_rect_rows > 0) {
int pr = g_pane_rect_row, pc = g_pane_rect_col;
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
Comment on lines +999 to +1003
}

if (col == g_sel_end_col && row == g_sel_end_row) return;

if (g_click_count >= 3) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/linux_render_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ int emitString(Vertex* v, int i, GlyphCache* gc,

int cellIsSelected(int row, int col) {
if (!g_sel_active) return 0;
// In copy mode with splits, clip selection to focused pane rect
if (g_copy_mode && g_pane_rect_rows > 0) {
// With splits, clip selection to focused pane rect
if ((g_copy_mode || g_split_active) && g_pane_rect_rows > 0) {
int pr = g_pane_rect_row, pc = g_pane_rect_col;
if (row < pr || row >= pr + g_pane_rect_rows || col < pc || col >= pc + g_pane_rect_cols) return 0;
}
Expand Down
21 changes: 21 additions & 0 deletions src/app/macos_input.m
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ - (void)mouseDown:(NSEvent *)event {
row -= g_grid_top_offset;
if (row < 0) row = 0;

// Clamp to focused pane bounds when splits are active
if (g_split_active && g_pane_rect_rows > 0) {
int pr = g_pane_rect_row, pc = g_pane_rect_col;
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
Comment on lines +378 to +382
}

if (event.modifierFlags & NSEventModifierFlagCommand) {
int cols = g_cols, rows_n = g_rows;
if (g_cells && col >= 0 && col < cols && row >= 0 && row < rows_n) {
Expand Down Expand Up @@ -664,6 +674,17 @@ - (void)mouseDragged:(NSEvent *)event {
mouseCell0(event, self, &col, &row);
row -= g_grid_top_offset;
if (row < 0) row = 0;

// Clamp to focused pane bounds when splits are active
if (g_split_active && g_pane_rect_rows > 0) {
int pr = g_pane_rect_row, pc = g_pane_rect_col;
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr) row = pr;
if (row >= pe) row = pe - 1;
if (col < pc) col = pc;
if (col >= pce) col = pce - 1;
Comment on lines +681 to +685
}

if (col == g_sel_end_col && row == g_sel_end_row) return;

if (_clickCount >= 3) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/macos_renderer_draw.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

static BOOL cellIsSelected(int row, int col) {
if (!g_sel_active) return NO;
// In copy mode with splits, clip selection to focused pane rect
if (g_copy_mode && g_pane_rect_rows > 0) {
// With splits, clip selection to focused pane rect
if ((g_copy_mode || g_split_active) && g_pane_rect_rows > 0) {
int pr = g_pane_rect_row, pc = g_pane_rect_col;
int pe = pr + g_pane_rect_rows, pce = pc + g_pane_rect_cols;
if (row < pr || row >= pe || col < pc || col >= pce) return NO;
Expand Down
9 changes: 8 additions & 1 deletion src/app/ui/selection.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ pub fn copySelection(is_block: bool) void {
const total_lines = sb_count + grid_rows;
if (total_lines <= 0) return;

// Read and normalize selection bounds (viewport-relative)
// Read and normalize selection bounds (viewport-relative).
// In split mode, coords are in global content-space — convert to pane-local.
var sr: i32 = c.g_sel_start_row;
var sc: i32 = c.g_sel_start_col;
var er: i32 = c.g_sel_end_row;
var ec: i32 = c.g_sel_end_col;
if (c.g_split_active != 0 and c.g_pane_rect_rows > 0) {
sr -= c.g_pane_rect_row;
er -= c.g_pane_rect_row;
sc -= c.g_pane_rect_col;
ec -= c.g_pane_rect_col;
}
Comment on lines +24 to +35
if (sr > er or (sr == er and sc > ec)) {
const tr = sr;
const tc = sc;
Expand Down
Loading