diff options
Diffstat (limited to 'im.h')
-rw-r--r-- | im.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -212,6 +212,14 @@ void im_preview(int fd, int trows, int tcols) { //writes the preview write(fd,preview_buffer,strlen(preview_buffer)); } +void restrict_scroll(int fd, int trows, int tcols) { + char pos_str[32] = ""; + int l = snprintf(pos_str, 32, "\033[0;%dr", trows-1); + write(fd, pos_str,l); +} +void unrestrict_scroll(int fd) { + write(fd,"\033[0;0r", 6); +} //Displays the IM on the bottom line, input is the number of actual physical //rows and columns on the terminal descibed by fd void disp_im(int fd, int trows, int tcols) { @@ -225,6 +233,7 @@ void disp_im(int fd, int trows, int tcols) { int l = snprintf(pos_str, 32, "\033[%d;%df", trows, im_col); write(fd,"\0337",2); //saves previous cursor position + unrestrict_scroll(fd); //unrestricts the scrolling region write(fd, pos_str,l); write(fd,"\033[7m",4); //invert video @@ -249,6 +258,9 @@ void disp_im(int fd, int trows, int tcols) { if (IM_PREVIEW) { im_preview(fd, trows, tcols); } + //restricts scroll region again + restrict_scroll(fd, trows, tcols); + //resets scroll region //restore cursor pos and attrbutes write(fd,"\033[0m",4); write(fd,"\0338",2); |