Skip to content

Instantly share code, notes, and snippets.

@saitoha
Created June 6, 2013 16:02
Show Gist options
  • Select an option

  • Save saitoha/5722673 to your computer and use it in GitHub Desktop.

Select an option

Save saitoha/5722673 to your computer and use it in GitHub Desktop.
Make CR behavior respect left margin when vertical split mode is enabled.
diff -rNU5 a/cursor.c b/cursor.c
--- a/cursor.c 2012-06-04 04:57:47.000000000 +0900
+++ b/cursor.c 2013-06-07 00:23:08.000000000 +0900
@@ -269,12 +269,14 @@
int left = ScrnLeftMargin(xw);
int col;
if (xw->flags & ORIGIN) {
col = left;
- } else if (screen->cur_col > left) {
- col = left;
+ } else if (IsLeftRightMode(xw)) {
+ if (ScrnIsColInMargins(screen, screen->cur_col)) {
+ col = left;
+ }
} else {
/*
* If origin-mode is not active, it is possible to use cursor
* addressing outside the margins. In that case we will go to the
* first column rather than following the margin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment