Skip to content
Merged
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
9 changes: 7 additions & 2 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2410,8 +2410,13 @@ impl<'a> Context<'a, '_> {
// If the line has some indentation and the user pressed Home,
// the first time it'll stop at the indentation. The second time
// they press it, it'll move to the true start of the line.
let indent_end = tb.indent_end_logical_pos();
if logical_after.x == 0 && logical_before > indent_end {
//
// If the cursor is already at the start of the line,
// we move it back to the end of the indentation.
if logical_after.x == 0
&& let indent_end = tb.indent_end_logical_pos()
&& (logical_before > indent_end || logical_before.x == 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I was curious about it, I tried implementing it myself. The correct approach is checking for logical_before.x == 0.

I also made the optimization I described above, by moving the indent_end_logical_pos call into the let chain.

{
if modifiers == kbmod::SHIFT {
tb.selection_update_logical(indent_end);
} else {
Expand Down