diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-01-20 19:32:30 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-01-20 19:32:30 -0600 |
commit | 41a06a7941a5d49f064f42f198351d90d0aceb4d (patch) | |
tree | a4bce84855cae8ff55aa7b4069a538d0449c4322 /apps/system/vi | |
parent | a9df2bc46e882b9d5f0369d7799426390f6cfa06 (diff) | |
download | px4-nuttx-41a06a7941a5d49f064f42f198351d90d0aceb4d.tar.gz px4-nuttx-41a06a7941a5d49f064f42f198351d90d0aceb4d.tar.bz2 px4-nuttx-41a06a7941a5d49f064f42f198351d90d0aceb4d.zip |
VI: Display origin for VT100 is (1,1), not (0,0)
Diffstat (limited to 'apps/system/vi')
-rw-r--r-- | apps/system/vi/.gitignore | 11 | ||||
-rw-r--r-- | apps/system/vi/vi.c | 10 |
2 files changed, 16 insertions, 5 deletions
diff --git a/apps/system/vi/.gitignore b/apps/system/vi/.gitignore new file mode 100644 index 000000000..83bd7b811 --- /dev/null +++ b/apps/system/vi/.gitignore @@ -0,0 +1,11 @@ +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/vi/vi.c b/apps/system/vi/vi.c index ab2669cee..83dbbb3b6 100644 --- a/apps/system/vi/vi.c +++ b/apps/system/vi/vi.c @@ -572,9 +572,9 @@ static void vi_setcursor(FAR struct vi_s *vi, uint16_t row, uint16_t column) vivdbg("row=%d column=%d\n", row, column); - /* Format the cursor position command */ + /* Format the cursor position command. The origin is (1,1). */ - len = snprintf(buffer, 16, g_fmtcursorpos, row, column); + len = snprintf(buffer, 16, g_fmtcursorpos, row + 1, column + 1); /* Send the VT100 CURSORPOS command */ @@ -1557,7 +1557,7 @@ static void vi_showtext(FAR struct vi_s *vi) /* If there was not enough text to fill the display, clear the * remaining lines (except for any possible error line at the - & bottom of the display). + * bottom of the display). */ for (; row < endrow; row++) @@ -1676,7 +1676,7 @@ static off_t vi_cursorleft(FAR struct vi_s *vi, off_t curpos, int ncolumns) vivdbg("curpos=%ld ncolumns=%d\n", curpos, ncolumns); - for (remaining = ncolumns < 1 ? 1 : ncolumns; + for (remaining = (ncolumns < 1 ? 1 : ncolumns); curpos > 0 && remaining > 0 && vi->text[curpos] != '\n'; curpos--, remaining--); @@ -1699,7 +1699,7 @@ static off_t vi_cursorright(FAR struct vi_s *vi, off_t curpos, int ncolumns) vivdbg("curpos=%ld ncolumns=%d\n", curpos, ncolumns); - for (remaining = ncolumns < 1 ? 1 : ncolumns; + for (remaining = (ncolumns < 1 ? 1 : ncolumns); curpos < vi->textsize && remaining > 0 && vi->text[curpos] != '\n'; curpos++, remaining--); |