From d37e0a387bd0177951b28bba9a15f31123fc465e Mon Sep 17 00:00:00 2001 From: tauraamui Date: Wed, 30 Oct 2024 23:24:55 +0000 Subject: [PATCH 01/15] refactor: comment existing implementation start from scratch --- experiment/{ => gui_render}/main.v | 0 src/view.v | 5 +++++ 2 files changed, 5 insertions(+) rename experiment/{ => gui_render}/main.v (100%) diff --git a/experiment/main.v b/experiment/gui_render/main.v similarity index 100% rename from experiment/main.v rename to experiment/gui_render/main.v diff --git a/src/view.v b/src/view.v index 49db7b11..a0b6abcc 100644 --- a/src/view.v +++ b/src/view.v @@ -791,6 +791,10 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { + ctx.set_bg_color(r: 53, g: 53, b: 53) + ctx.draw_text(screen_space_x + 1, screen_space_y + 1, line_runes.string()) + ctx.reset_bg_color() + /* mut x_offset := 0 tab_count := original_line_runes[..selection_start.x].string().count('\t') selection_x_offset := tab_count * 3 @@ -827,6 +831,7 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con document_space_y, post_sel.string()) x_offset += post_sel.len } + */ } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From f24a764c37c0dcce806cac5166d7424aac168156 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Fri, 1 Nov 2024 20:03:14 +0000 Subject: [PATCH 02/15] wip --- src/view.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view.v b/src/view.v index a0b6abcc..cf9cc8d4 100644 --- a/src/view.v +++ b/src/view.v @@ -792,7 +792,9 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con original_line_runes []rune ) { ctx.set_bg_color(r: 53, g: 53, b: 53) - ctx.draw_text(screen_space_x + 1, screen_space_y + 1, line_runes.string()) + // ctx.draw_text(screen_space_x + 1, screen_space_y + 1, line_runes.string()) + draw_text_line_as_segments(mut ctx, syntax, screen_space_x, screen_space_y, + document_space_y, line_runes.string()) ctx.reset_bg_color() /* mut x_offset := 0 From 674b95d741b55093360978d3bc8b1c021477fa7e Mon Sep 17 00:00:00 2001 From: tauraamui Date: Sat, 2 Nov 2024 14:43:52 +0000 Subject: [PATCH 03/15] WIP test --- src/view_test.v | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/view_test.v b/src/view_test.v index eef661bf..9ba41d09 100644 --- a/src/view_test.v +++ b/src/view_test.v @@ -508,6 +508,35 @@ fn (mockctx MockContextable) clear() {} fn (mockctx MockContextable) flush() {} +struct DrawnTextRec { + content string + pos Pos +} + +fn test_draw_text_line_visual_selection_start_end_on_same_line() { + mut drawn_text := []DrawnTextRec{} + mut drawn_text_ref := &drawn_text + + mut m_ctx := MockContextable{ + on_draw_cb: fn [mut drawn_text_ref] (x int, y int, text string) { + drawn_text_ref << DrawnTextRec{ + content: text, + pos: Pos{ x: x, y: y } + } + } + } + + mut m_cursor := Cursor{ pos: Pos{ x: 71, y: 0 }, selection_start_pos: Pos{ x: 44, y: 0 } } + document_line := 'This part of the text is before the selection but this part is within it, and this part is after it' + draw_text_line_within_visual_selection( + mut m_ctx, resolve_test_syntax(), + m_cursor, Color{ r: 10, g: 10, b: 10 }, + 0, 0, 0, 0, document_line, document_line + ) + + assert drawn_text.len == 4 +} + fn test_draw_text_line_within_visual_selection_start_end_on_same_line_with_tab_prefix() { mut drawed_text := []string{} mut drawed_text_ref := &drawed_text From dbde555ebf560d3d8fea5451a0bd3b9d250b58d3 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Wed, 6 Nov 2024 20:34:52 +0000 Subject: [PATCH 04/15] Squash merge master into LIL-76/fix/visual-selection-highlight --- src/view.v | 3 --- src/view_test.v | 30 +++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/view.v b/src/view.v index cf9cc8d4..4a38785e 100644 --- a/src/view.v +++ b/src/view.v @@ -1349,9 +1349,6 @@ fn (mut view View) insert_text(s string) { fn (mut view View) escape() { // TODO(tauraamui) -> completely re-write this method defer { - if view.cursor.selection_active() { - view.cursor.pos.y = view.cursor.selection_start().y - } view.cursor.selection_start_pos = Pos{-1, -1} view.clamp_cursor_within_document_bounds() view.scroll_from_and_to() diff --git a/src/view_test.v b/src/view_test.v index 9ba41d09..d75cc846 100644 --- a/src/view_test.v +++ b/src/view_test.v @@ -339,7 +339,7 @@ fn test_o_auto_indents_but_clears_if_nothing_added_to_line() { assert fake_view.leader_state.mode == .normal assert fake_view.buffer.lines == [' 1. first line', ''] - assert fake_view.cursor.pos.y == 0 // cursor y set back to selection start pos + assert fake_view.cursor.pos.y == 1 // cursor y does not move to selection start pos } fn test_resolve_whitespace_prefix_on_line_with_text() { @@ -1173,6 +1173,34 @@ fn test_visual_selection_copy_starts_and_ends_on_same_line_and_selects_whole_lin } } +fn test_visual_selection_mode_escaped_leaves_cursor_in_final_position() { + mut clip := clipboardv2.new() + mut fake_view := View{ + log: unsafe { nil } + leader_state: ViewLeaderState{ mode: .normal } + clipboard: mut clip + } + + // manually set the documents contents + fake_view.buffer.lines = [ + '1. first line', + '2. second line', + '3. third line', + '4. fourth line', + '5. fifth line', + ] + + // ensure cursor is set to start inside second line + fake_view.cursor.pos.x = 0 + fake_view.cursor.pos.y = 1 + fake_view.shift_v() + fake_view.j() + fake_view.j() + fake_view.j() + fake_view.escape() + assert fake_view.cursor.pos.y == 4 +} + /* fn test_visual_selection_copy_ends_on_halfway_in_on_next_line_down() { mut clip := clipboardv2.new() From 3ff2fa64f8726d884b55aa416dc479d91038dd13 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Wed, 6 Nov 2024 22:50:04 +0000 Subject: [PATCH 05/15] wip: start re-implementing visual selection starts and ends on same line --- src/view.v | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/src/view.v b/src/view.v index 4a38785e..86dcd913 100644 --- a/src/view.v +++ b/src/view.v @@ -791,49 +791,17 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { - ctx.set_bg_color(r: 53, g: 53, b: 53) - // ctx.draw_text(screen_space_x + 1, screen_space_y + 1, line_runes.string()) - draw_text_line_as_segments(mut ctx, syntax, screen_space_x, screen_space_y, - document_space_y, line_runes.string()) - ctx.reset_bg_color() - /* mut x_offset := 0 tab_count := original_line_runes[..selection_start.x].string().count('\t') selection_x_offset := tab_count * 3 pre_sel := line_runes[..selection_start.x + selection_x_offset] - sel := line_runes[selection_start.x + x_offset + selection_x_offset..selection_end.x + - selection_x_offset] - post_sel := line_runes[selection_end.x + selection_x_offset..] - if pre_sel.len != 0 { - if screen_space_y == cursor_screen_space_y { - ctx.set_bg_color(r: 53, g: 53, b: 53) - } - draw_text_line_as_segments(mut ctx, syntax, screen_space_x + x_offset, screen_space_y, + ctx.set_bg_color(r: 53, g: 53, b: 53) + if pre_sel.len > 0 { + draw_text_line_as_segments(mut ctx, syntax, screen_space_x, screen_space_y, document_space_y, pre_sel.string()) x_offset += pre_sel.len } - - if sel.len != 0 { - ctx.set_bg_color( - r: selection_highlight_color.r - g: selection_highlight_color.g - b: selection_highlight_color.b - ) - ctx.draw_text(screen_space_x + x_offset + 1, screen_space_y + 1, sel.string()) - ctx.reset_bg_color() - x_offset += sel.len - } - - if post_sel.len != 0 { - if screen_space_y == cursor_screen_space_y { - ctx.set_bg_color(r: 53, g: 53, b: 53) - } - draw_text_line_as_segments(mut ctx, syntax, screen_space_x + x_offset, screen_space_y, - document_space_y, post_sel.string()) - x_offset += post_sel.len - } - */ } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From 43f232c6f4dc961870d189681390eee122b3ed36 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Wed, 6 Nov 2024 22:59:33 +0000 Subject: [PATCH 06/15] wip: render selection span for start end on same line --- src/view.v | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/view.v b/src/view.v index 86dcd913..7336298b 100644 --- a/src/view.v +++ b/src/view.v @@ -795,13 +795,28 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con tab_count := original_line_runes[..selection_start.x].string().count('\t') selection_x_offset := tab_count * 3 pre_sel := line_runes[..selection_start.x + selection_x_offset] + sel := line_runes[selection_start.x + selection_x_offset..selection_end.x + selection_x_offset] ctx.set_bg_color(r: 53, g: 53, b: 53) if pre_sel.len > 0 { - draw_text_line_as_segments(mut ctx, syntax, screen_space_x, screen_space_y, - document_space_y, pre_sel.string()) + draw_text_line_as_segments( + mut ctx, syntax, + screen_space_x, screen_space_y, + document_space_y, pre_sel.string() + ) x_offset += pre_sel.len } + + if sel.len > 0 { + ctx.set_bg_color( + r: selection_highlight_color.r + g: selection_highlight_color.g + b: selection_highlight_color.b + ) + ctx.draw_text(screen_space_x + x_offset + 1, screen_space_y + 1, sel.string()) + ctx.reset_bg_color() + x_offset += sel.len + } } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From c4ff1de09322f115f3cc3547767f4de68172347e Mon Sep 17 00:00:00 2001 From: tauraamui Date: Wed, 6 Nov 2024 23:41:20 +0000 Subject: [PATCH 07/15] wip: render full line but in uncoloured segments --- src/view.v | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/view.v b/src/view.v index 7336298b..d6446c89 100644 --- a/src/view.v +++ b/src/view.v @@ -791,11 +791,17 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { + pre_selection := line_runes[..selection_start.x] + ctx.draw_text(screen_space_x + 1, screen_space_y + 1, pre_selection.string()) + content_after_selection_start := line_runes[selection_start.x..] + ctx.draw_text(screen_space_x + 1 + (line_runes.len - content_after_selection_start.len), screen_space_y + 1, content_after_selection_start.string()) + /* mut x_offset := 0 tab_count := original_line_runes[..selection_start.x].string().count('\t') selection_x_offset := tab_count * 3 - pre_sel := line_runes[..selection_start.x + selection_x_offset] - sel := line_runes[selection_start.x + selection_x_offset..selection_end.x + selection_x_offset] + pre_sel := line_runes[..selection_start.x + selection_x_offset] + sel := line_runes[selection_start.x + selection_x_offset..selection_end.x + selection_x_offset] + post_sel := line_runes[selection_end.x + selection_x_offset..] ctx.set_bg_color(r: 53, g: 53, b: 53) if pre_sel.len > 0 { @@ -817,6 +823,7 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con ctx.reset_bg_color() x_offset += sel.len } + */ } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From f2c96da15940556222d9a68059ad25a2c0684866 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Wed, 6 Nov 2024 23:51:22 +0000 Subject: [PATCH 08/15] fix: offset the picking of runes from render string by tab count --- src/view.v | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/view.v b/src/view.v index d6446c89..612851a1 100644 --- a/src/view.v +++ b/src/view.v @@ -791,10 +791,18 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { - pre_selection := line_runes[..selection_start.x] + selection_x_offset := (original_line_runes[..selection_start.x].string().count('\t')) * 3 + pre_selection := line_runes[..selection_start.x + selection_x_offset] + ctx.set_bg_color(r: 190, g: 10, b: 10) ctx.draw_text(screen_space_x + 1, screen_space_y + 1, pre_selection.string()) - content_after_selection_start := line_runes[selection_start.x..] + content_after_selection_start := line_runes[selection_x_offset + selection_start.x..] + ctx.set_bg_color( + r: selection_highlight_color.r + g: selection_highlight_color.g + b: selection_highlight_color.b + ) ctx.draw_text(screen_space_x + 1 + (line_runes.len - content_after_selection_start.len), screen_space_y + 1, content_after_selection_start.string()) + ctx.reset_bg_color() /* mut x_offset := 0 tab_count := original_line_runes[..selection_start.x].string().count('\t') From 4e5d6381f9cee13d45528f2c3b15e8b2759e0512 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Wed, 6 Nov 2024 23:59:01 +0000 Subject: [PATCH 09/15] WIP --- src/view.v | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/view.v b/src/view.v index 612851a1..663991d3 100644 --- a/src/view.v +++ b/src/view.v @@ -795,14 +795,6 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con pre_selection := line_runes[..selection_start.x + selection_x_offset] ctx.set_bg_color(r: 190, g: 10, b: 10) ctx.draw_text(screen_space_x + 1, screen_space_y + 1, pre_selection.string()) - content_after_selection_start := line_runes[selection_x_offset + selection_start.x..] - ctx.set_bg_color( - r: selection_highlight_color.r - g: selection_highlight_color.g - b: selection_highlight_color.b - ) - ctx.draw_text(screen_space_x + 1 + (line_runes.len - content_after_selection_start.len), screen_space_y + 1, content_after_selection_start.string()) - ctx.reset_bg_color() /* mut x_offset := 0 tab_count := original_line_runes[..selection_start.x].string().count('\t') From 1620e48b302af15ae976636820f28e0ec74b9434 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Thu, 7 Nov 2024 11:44:19 +0000 Subject: [PATCH 10/15] wip: debug render pre selection --- src/view.v | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/src/view.v b/src/view.v index 663991d3..e9ded840 100644 --- a/src/view.v +++ b/src/view.v @@ -791,39 +791,11 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { - selection_x_offset := (original_line_runes[..selection_start.x].string().count('\t')) * 3 - pre_selection := line_runes[..selection_start.x + selection_x_offset] - ctx.set_bg_color(r: 190, g: 10, b: 10) + x_offset := original_line_runes[..selection_start.x].string().count('\t') * 3 + pre_selection := line_runes[..x_offset + selection_start.x] + ctx.set_bg_color(r: 200, g: 20, b: 20) ctx.draw_text(screen_space_x + 1, screen_space_y + 1, pre_selection.string()) - /* - mut x_offset := 0 - tab_count := original_line_runes[..selection_start.x].string().count('\t') - selection_x_offset := tab_count * 3 - pre_sel := line_runes[..selection_start.x + selection_x_offset] - sel := line_runes[selection_start.x + selection_x_offset..selection_end.x + selection_x_offset] - post_sel := line_runes[selection_end.x + selection_x_offset..] - - ctx.set_bg_color(r: 53, g: 53, b: 53) - if pre_sel.len > 0 { - draw_text_line_as_segments( - mut ctx, syntax, - screen_space_x, screen_space_y, - document_space_y, pre_sel.string() - ) - x_offset += pre_sel.len - } - - if sel.len > 0 { - ctx.set_bg_color( - r: selection_highlight_color.r - g: selection_highlight_color.g - b: selection_highlight_color.b - ) - ctx.draw_text(screen_space_x + x_offset + 1, screen_space_y + 1, sel.string()) - ctx.reset_bg_color() - x_offset += sel.len - } - */ + ctx.reset_bg_color() } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From 5c138bf3e600d2d42ecef7c45f177757b37e65a6 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Thu, 7 Nov 2024 12:15:37 +0000 Subject: [PATCH 11/15] WIP --- src/view.v | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/view.v b/src/view.v index e9ded840..8c121e7b 100644 --- a/src/view.v +++ b/src/view.v @@ -791,8 +791,9 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { - x_offset := original_line_runes[..selection_start.x].string().count('\t') * 3 - pre_selection := line_runes[..x_offset + selection_start.x] + mut x_offset := original_line_runes[..selection_start.x].string().count('\t') + pre_selection := line_runes[..(x_offset * 3) + selection_start.x] + ctx.set_bg_color(r: 200, g: 20, b: 20) ctx.draw_text(screen_space_x + 1, screen_space_y + 1, pre_selection.string()) ctx.reset_bg_color() From 18945de2c37eff57d441b2b03a79550b8d657674 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Sat, 9 Nov 2024 19:38:56 +0000 Subject: [PATCH 12/15] wip --- src/view.v | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/view.v b/src/view.v index 8c121e7b..4e652ffd 100644 --- a/src/view.v +++ b/src/view.v @@ -791,12 +791,17 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { - mut x_offset := original_line_runes[..selection_start.x].string().count('\t') - pre_selection := line_runes[..(x_offset * 3) + selection_start.x] - - ctx.set_bg_color(r: 200, g: 20, b: 20) + pre_tab_count := original_line_runes[..selection_start.x].string().count('\t') + pre_selection := line_runes[..selection_start.x + (pre_tab_count * 3)] + ctx.set_bg_color(r: 200, g: 10, b: 10) ctx.draw_text(screen_space_x + 1, screen_space_y + 1, pre_selection.string()) ctx.reset_bg_color() + + sel_tab_count := original_line_runes[selection_start.x..selection_end.x].string().count('\t') + within_selection := line_runes[selection_start.x + (pre_tab_count * 3)..selection_end.x + ((pre_tab_count + sel_tab_count) * 3)] + ctx.set_bg_color(r: 10, g: 200, b: 10) + ctx.draw_text(screen_space_x + 1 + pre_selection.len, screen_space_y + 1, within_selection.string()) + ctx.reset_bg_color() } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From 8feae7d96886c5a0725c63fd67b426120bbb5ed2 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Sat, 9 Nov 2024 19:45:05 +0000 Subject: [PATCH 13/15] fix: render remaining line past selection span --- src/view.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/view.v b/src/view.v index 4e652ffd..d81df4d9 100644 --- a/src/view.v +++ b/src/view.v @@ -802,6 +802,11 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con ctx.set_bg_color(r: 10, g: 200, b: 10) ctx.draw_text(screen_space_x + 1 + pre_selection.len, screen_space_y + 1, within_selection.string()) ctx.reset_bg_color() + + post_selection := line_runes[selection_end.x + ((pre_tab_count + sel_tab_count) * 3)..] + ctx.set_bg_color(r: 10, g: 10, b: 200) + ctx.draw_text(screen_space_x + 1 + pre_selection.len + within_selection.len, screen_space_y + 1, post_selection.string()) + ctx.reset_bg_color() } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From 471a2b2c26b424e0f6a30982fcf416e5a1b138c5 Mon Sep 17 00:00:00 2001 From: tauraamui Date: Sat, 9 Nov 2024 19:51:57 +0000 Subject: [PATCH 14/15] fix: render pre, within and post selections correctly! --- src/view.v | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/view.v b/src/view.v index d81df4d9..70c17555 100644 --- a/src/view.v +++ b/src/view.v @@ -791,22 +791,25 @@ fn draw_text_line_visual_selection_starts_and_ends_on_same_line(mut ctx draw.Con line_runes []rune, original_line_runes []rune ) { + ctx.set_bg_color(r: 53, g: 53, b: 53) + defer { ctx.reset_bg_color() } pre_tab_count := original_line_runes[..selection_start.x].string().count('\t') pre_selection := line_runes[..selection_start.x + (pre_tab_count * 3)] - ctx.set_bg_color(r: 200, g: 10, b: 10) - ctx.draw_text(screen_space_x + 1, screen_space_y + 1, pre_selection.string()) - ctx.reset_bg_color() + draw_text_line_as_segments(mut ctx, syntax, screen_space_x, screen_space_y, document_space_y, pre_selection.string()) sel_tab_count := original_line_runes[selection_start.x..selection_end.x].string().count('\t') within_selection := line_runes[selection_start.x + (pre_tab_count * 3)..selection_end.x + ((pre_tab_count + sel_tab_count) * 3)] - ctx.set_bg_color(r: 10, g: 200, b: 10) + ctx.set_bg_color( + r: selection_highlight_color.r + g: selection_highlight_color.g + b: selection_highlight_color.b + ) ctx.draw_text(screen_space_x + 1 + pre_selection.len, screen_space_y + 1, within_selection.string()) ctx.reset_bg_color() + ctx.set_bg_color(r: 53, g: 53, b: 53) post_selection := line_runes[selection_end.x + ((pre_tab_count + sel_tab_count) * 3)..] - ctx.set_bg_color(r: 10, g: 10, b: 200) - ctx.draw_text(screen_space_x + 1 + pre_selection.len + within_selection.len, screen_space_y + 1, post_selection.string()) - ctx.reset_bg_color() + draw_text_line_as_segments(mut ctx, syntax, screen_space_x + pre_selection.len + within_selection.len, screen_space_y, document_space_y, post_selection.string()) } fn draw_text_line_visual_selection_starts_on_same_but_ends_after(mut ctx draw.Contextable, From 52bb16f440f1525d69af15d9d7c3a85bffebc8ff Mon Sep 17 00:00:00 2001 From: tauraamui Date: Sat, 9 Nov 2024 19:52:05 +0000 Subject: [PATCH 15/15] test: amend drawn text len --- src/view_test.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view_test.v b/src/view_test.v index d75cc846..c6d75779 100644 --- a/src/view_test.v +++ b/src/view_test.v @@ -534,7 +534,7 @@ fn test_draw_text_line_visual_selection_start_end_on_same_line() { 0, 0, 0, 0, document_line, document_line ) - assert drawn_text.len == 4 + assert drawn_text.len == 3 } fn test_draw_text_line_within_visual_selection_start_end_on_same_line_with_tab_prefix() {