[bim] More cleanup
This commit is contained in:
parent
c5e42f80e7
commit
e0447ffa34
35
apps/bim.c
35
apps/bim.c
@ -6,13 +6,15 @@
|
|||||||
*
|
*
|
||||||
* bim - Text editor
|
* bim - Text editor
|
||||||
*
|
*
|
||||||
* bim is a "Bad IMitation" of vim. This is the standard text
|
* Bim is inspired by vim, and its name is short for "Bad IMitation".
|
||||||
* editor fo ToaruOS. It provides basic editing capabilities.
|
|
||||||
*
|
*
|
||||||
* Expansion of bim is planned. I'd love to see it one day have
|
* Bim supports basic syntax highlighting, has a mode-based interface
|
||||||
* syntax hilighting, for example. It's also painfully slow,
|
* similar to vim's, and can be built for ToaruOS and Linux (and should
|
||||||
* so speed improvement is a must - most probably by not
|
* be easily portable to other Unix-likes).
|
||||||
* redrawing the entire screen all the time.
|
*
|
||||||
|
* Future goals:
|
||||||
|
* - History stack
|
||||||
|
* - Selection
|
||||||
*/
|
*/
|
||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 500
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -1117,6 +1119,20 @@ void mouse_disable(void) {
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shift the screen up one line
|
||||||
|
*/
|
||||||
|
void shift_up(void) {
|
||||||
|
printf("\033[1S");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shift the screen down one line.
|
||||||
|
*/
|
||||||
|
void shift_down(void) {
|
||||||
|
printf("\033[1T");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redaw the tabbar, with a tab for each buffer.
|
* Redaw the tabbar, with a tab for each buffer.
|
||||||
*
|
*
|
||||||
@ -1888,7 +1904,7 @@ void cursor_down(void) {
|
|||||||
env->offset += 1;
|
env->offset += 1;
|
||||||
|
|
||||||
/* Tell terminal to scroll */
|
/* Tell terminal to scroll */
|
||||||
printf("\033[1S");
|
shift_up();
|
||||||
|
|
||||||
/* A new line appears on screen at the bottom, draw it */
|
/* A new line appears on screen at the bottom, draw it */
|
||||||
int l = term_height - env->bottom_size - 1;
|
int l = term_height - env->bottom_size - 1;
|
||||||
@ -1956,7 +1972,7 @@ void cursor_up(void) {
|
|||||||
env->offset -= 1;
|
env->offset -= 1;
|
||||||
|
|
||||||
/* Tell terminal to scroll */
|
/* Tell terminal to scroll */
|
||||||
printf("\033[1T");
|
shift_down();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The line at the top of the screen should always be real
|
* The line at the top of the screen should always be real
|
||||||
@ -2066,7 +2082,8 @@ void process_command(char * cmd) {
|
|||||||
/* Special case ! to run shell commands without parsing tokens */
|
/* Special case ! to run shell commands without parsing tokens */
|
||||||
if (*cmd == '!') {
|
if (*cmd == '!') {
|
||||||
/* Reset and draw some line feeds */
|
/* Reset and draw some line feeds */
|
||||||
printf("\033[0m\n\n");
|
reset();
|
||||||
|
printf("\n\n");
|
||||||
|
|
||||||
/* Set buffered for shell application */
|
/* Set buffered for shell application */
|
||||||
set_buffered();
|
set_buffered();
|
||||||
|
Loading…
Reference in New Issue
Block a user