summaryrefslogtreecommitdiff
path: root/ptyim.c
diff options
context:
space:
mode:
Diffstat (limited to 'ptyim.c')
-rw-r--r--ptyim.c44
1 files changed, 2 insertions, 42 deletions
diff --git a/ptyim.c b/ptyim.c
index 6fa6ac1..35f5563 100644
--- a/ptyim.c
+++ b/ptyim.c
@@ -34,47 +34,7 @@ void winchhook(int a) {
ioctl(pty_slave, TIOCSWINSZ, &sz);
}
-void disp_im() {
- //3 spaces for the im indicator +1 for automargin
- int im_col = tcols - IM_TABLE_ENTRY_LEN - 4;
- char pos_str[32] = "";
- int l = sprintf(pos_str, "\033[%d;%df",trows, im_col);
- //printf("\0337");
- //printf("\033[%d;%df",trows,im_col);
- //printf("\033[0;0f",trows,im_col);
- //printf("\033[7m");
- //if (im_on) {
- // printf("漢");
- //} else {
- // printf("英");
- //}
- //printf("%s",im_buffer);
- //printf("\033[0m");
- //printf("\0338");
- write(STDOUT_FILENO,"\0337",2);
- //also writes to top left the current im buffer
- //write(STDOUT_FILENO,"\033[33;14f",8);
- //write(STDOUT_FILENO,"\033[0;4f",6);
- //write to the bottom left corner
- write(STDOUT_FILENO, pos_str,l);
- //invert video
- write(STDOUT_FILENO,"\033[7m",4);
- //overwrite what was there previously
- write(STDOUT_FILENO," ",
- IM_TABLE_ENTRY_LEN+4);
- write(STDOUT_FILENO, pos_str,l);
- //im mode indicator
- if (im_on) {
- write(STDOUT_FILENO,"漢:",4);
- } else {
- write(STDOUT_FILENO,"英:",4);
- }
- //actual buffer
- write(STDOUT_FILENO,im_buffer,im_buffer_pos);
- //restore cursor pos and attrbutes
- write(STDOUT_FILENO,"\033[0m",4);
- write(STDOUT_FILENO,"\0338",2);
-}
+
int main (int argc, char * argv[], char * envp[]) {
//creates the pty master
int pty_master = posix_openpt(O_RDWR);
@@ -187,7 +147,7 @@ int main (int argc, char * argv[], char * envp[]) {
if (im_chars >0) {
write(pty_master,input_buffer,im_chars);
}
- disp_im();
+ disp_im(STDIN_FILENO, trows, tcols);
}
}
}