mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
/SET indent_always - should we indent the long words that are forcibly
wrapped to next line. Default is ON. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1456 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c2483eff4e
commit
a321ad0150
@ -45,7 +45,8 @@ static GUI_WINDOW_REC *gui_window_init(WINDOW_REC *window,
|
|||||||
gui->parent = parent;
|
gui->parent = parent;
|
||||||
gui->view = textbuffer_view_create(textbuffer_create(),
|
gui->view = textbuffer_view_create(textbuffer_create(),
|
||||||
window->width, window->height,
|
window->width, window->height,
|
||||||
settings_get_int("indent"));
|
settings_get_int("indent"),
|
||||||
|
settings_get_bool("indent_always"));
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +284,8 @@ static void read_settings(void)
|
|||||||
WINDOW_REC *rec = tmp->data;
|
WINDOW_REC *rec = tmp->data;
|
||||||
|
|
||||||
textbuffer_view_set_default_indent(WINDOW_GUI(rec)->view,
|
textbuffer_view_set_default_indent(WINDOW_GUI(rec)->view,
|
||||||
settings_get_int("indent"));
|
settings_get_int("indent"),
|
||||||
|
settings_get_bool("indent_always"));
|
||||||
}
|
}
|
||||||
|
|
||||||
special_vars_add_signals(prompt, 4, funcs);
|
special_vars_add_signals(prompt, 4, funcs);
|
||||||
@ -296,6 +298,7 @@ void gui_windows_init(void)
|
|||||||
{
|
{
|
||||||
settings_add_bool("lookandfeel", "autostick_split_windows", TRUE);
|
settings_add_bool("lookandfeel", "autostick_split_windows", TRUE);
|
||||||
settings_add_int("lookandfeel", "indent", 10);
|
settings_add_int("lookandfeel", "indent", 10);
|
||||||
|
settings_add_bool("lookandfeel", "indent_always", FALSE);
|
||||||
settings_add_str("lookandfeel", "prompt", "[$[.15]T] ");
|
settings_add_str("lookandfeel", "prompt", "[$[.15]T] ");
|
||||||
settings_add_str("lookandfeel", "prompt_window", "[$winname] ");
|
settings_add_str("lookandfeel", "prompt_window", "[$winname] ");
|
||||||
|
|
||||||
|
@ -164,7 +164,8 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xpos == view->width && sub != NULL &&
|
if (xpos == view->width && sub != NULL &&
|
||||||
(last_space <= indent_pos || last_space <= 10)) {
|
(last_space <= indent_pos || last_space <= 10) &&
|
||||||
|
!view->longword_noindent) {
|
||||||
/* long word, remove the indentation from this line */
|
/* long word, remove the indentation from this line */
|
||||||
xpos -= sub->indent;
|
xpos -= sub->indent;
|
||||||
sub->indent = 0;
|
sub->indent = 0;
|
||||||
@ -179,7 +180,7 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
|||||||
color = last_color;
|
color = last_color;
|
||||||
ptr = last_space_ptr;
|
ptr = last_space_ptr;
|
||||||
while (*ptr == ' ') ptr++;
|
while (*ptr == ' ') ptr++;
|
||||||
} else {
|
} else if (!view->longword_noindent) {
|
||||||
/* long word, no indentation in next line */
|
/* long word, no indentation in next line */
|
||||||
xpos = 0;
|
xpos = 0;
|
||||||
sub->continues = TRUE;
|
sub->continues = TRUE;
|
||||||
@ -373,7 +374,8 @@ static void textbuffer_view_init_ypos(TEXT_BUFFER_VIEW_REC *view)
|
|||||||
/* Create new view. */
|
/* Create new view. */
|
||||||
TEXT_BUFFER_VIEW_REC *textbuffer_view_create(TEXT_BUFFER_REC *buffer,
|
TEXT_BUFFER_VIEW_REC *textbuffer_view_create(TEXT_BUFFER_REC *buffer,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int default_indent)
|
int default_indent,
|
||||||
|
int longword_noindent)
|
||||||
{
|
{
|
||||||
TEXT_BUFFER_VIEW_REC *view;
|
TEXT_BUFFER_VIEW_REC *view;
|
||||||
|
|
||||||
@ -386,7 +388,8 @@ TEXT_BUFFER_VIEW_REC *textbuffer_view_create(TEXT_BUFFER_REC *buffer,
|
|||||||
|
|
||||||
view->width = width;
|
view->width = width;
|
||||||
view->height = height;
|
view->height = height;
|
||||||
view->default_indent = default_indent;
|
view->default_indent = default_indent;
|
||||||
|
view->longword_noindent = longword_noindent;
|
||||||
|
|
||||||
view->cache = textbuffer_cache_get(view->siblings, width);
|
view->cache = textbuffer_cache_get(view->siblings, width);
|
||||||
textbuffer_view_init_bottom(view);
|
textbuffer_view_init_bottom(view);
|
||||||
@ -435,11 +438,11 @@ void textbuffer_view_destroy(TEXT_BUFFER_VIEW_REC *view)
|
|||||||
|
|
||||||
/* Change the default indent position */
|
/* Change the default indent position */
|
||||||
void textbuffer_view_set_default_indent(TEXT_BUFFER_VIEW_REC *view,
|
void textbuffer_view_set_default_indent(TEXT_BUFFER_VIEW_REC *view,
|
||||||
int default_indent)
|
int default_indent,
|
||||||
|
int longword_noindent)
|
||||||
{
|
{
|
||||||
g_return_if_fail(view != NULL);
|
view->default_indent = default_indent;
|
||||||
|
view->longword_noindent = longword_noindent;
|
||||||
view->default_indent = default_indent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int view_get_linecount_all(TEXT_BUFFER_VIEW_REC *view, GList *lines)
|
static int view_get_linecount_all(TEXT_BUFFER_VIEW_REC *view, GList *lines)
|
||||||
|
@ -43,9 +43,13 @@ typedef struct {
|
|||||||
|
|
||||||
WINDOW *window;
|
WINDOW *window;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
int default_indent;
|
int default_indent;
|
||||||
|
int longword_noindent:1;
|
||||||
|
|
||||||
TEXT_BUFFER_CACHE_REC *cache;
|
TEXT_BUFFER_CACHE_REC *cache;
|
||||||
|
int ypos; /* cursor position - visible area is 0..height-1 */
|
||||||
|
|
||||||
GList *startline; /* line at the top of the screen */
|
GList *startline; /* line at the top of the screen */
|
||||||
int subline; /* number of "real lines" to skip from `startline' */
|
int subline; /* number of "real lines" to skip from `startline' */
|
||||||
|
|
||||||
@ -59,12 +63,6 @@ typedef struct {
|
|||||||
/* window is at the bottom of the text buffer */
|
/* window is at the bottom of the text buffer */
|
||||||
unsigned int bottom:1;
|
unsigned int bottom:1;
|
||||||
|
|
||||||
/* info how to efficiently refresh window buffer */
|
|
||||||
//unsigned int redraw:1;
|
|
||||||
int ypos; /* cursor position - visible area is 0..height-1 */
|
|
||||||
/*GList *drawn_startline;
|
|
||||||
int drawn_subline;*/
|
|
||||||
|
|
||||||
/* Bookmarks to the lines in the buffer - removed automatically
|
/* Bookmarks to the lines in the buffer - removed automatically
|
||||||
when the line gets removed from buffer */
|
when the line gets removed from buffer */
|
||||||
GHashTable *bookmarks;
|
GHashTable *bookmarks;
|
||||||
@ -73,12 +71,14 @@ typedef struct {
|
|||||||
/* Create new view. */
|
/* Create new view. */
|
||||||
TEXT_BUFFER_VIEW_REC *textbuffer_view_create(TEXT_BUFFER_REC *buffer,
|
TEXT_BUFFER_VIEW_REC *textbuffer_view_create(TEXT_BUFFER_REC *buffer,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int default_indent);
|
int default_indent,
|
||||||
|
int longword_noindent);
|
||||||
/* Destroy the view. */
|
/* Destroy the view. */
|
||||||
void textbuffer_view_destroy(TEXT_BUFFER_VIEW_REC *view);
|
void textbuffer_view_destroy(TEXT_BUFFER_VIEW_REC *view);
|
||||||
/* Change the default indent position */
|
/* Change the default indent position */
|
||||||
void textbuffer_view_set_default_indent(TEXT_BUFFER_VIEW_REC *view,
|
void textbuffer_view_set_default_indent(TEXT_BUFFER_VIEW_REC *view,
|
||||||
int default_indent);
|
int default_indent,
|
||||||
|
int longword_noindent);
|
||||||
|
|
||||||
/* Resize the view. */
|
/* Resize the view. */
|
||||||
void textbuffer_view_resize(TEXT_BUFFER_VIEW_REC *view, int width, int height);
|
void textbuffer_view_resize(TEXT_BUFFER_VIEW_REC *view, int width, int height);
|
||||||
|
Loading…
Reference in New Issue
Block a user