matlinuxer2 / fbterm

Automatically exported from code.google.com/p/fbterm
GNU General Public License v2.0
0 stars 0 forks source link

logical error in insert mode. #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
in src/lib/vterm.cpp

        if (mode_flags.insert_mode) {
                changed_line(cursor_y, cursor_x, width - 1);

                u16 step = dw ? 2 : 1;
#if 0
                for (u16 i = cursor_x; i < width - step; i++) {
                        text[yp + i + step] = text[yp + i];
                        attrs[yp + i + step] = attrs[yp + i];
                }
#else
                /* BUG FIXED */
                for (s32 i = width - step; i >= cursor_x; i--) {
                        text[yp + i + step] = text[yp + i];
                        attrs[yp + i + step] = attrs[yp + i];
                }
#endif
        } else {
                changed_line(cursor_y, cursor_x, cursor_x + (dw ? 1 : 0));
        }

Original issue reported on code.google.com by babaya...@y8.dion.ne.jp on 16 Mar 2010 at 10:12

GoogleCodeExporter commented 8 years ago
Thanks for your patch, but the loop start index should be (width - step -1)

Original comment by zgchan...@gmail.com on 20 Mar 2010 at 10:23

GoogleCodeExporter commented 8 years ago

Original comment by zgchan...@gmail.com on 6 Oct 2010 at 3:52