Rewrote MooTermLine, added unicode stuff

This commit is contained in:
Yevgen Muntyan 2005-07-06 16:39:02 +00:00
parent f4e0c1f56e
commit ba2c348e20
16 changed files with 679 additions and 731 deletions

View File

@ -67,10 +67,10 @@ struct _MooTermPrivate {
MooTermVt *vt;
gboolean scrolled;
gulong _top_line;
// gulong old_scrollback;
// gulong old_width;
// gulong old_height;
guint _top_line;
// guint old_scrollback;
// guint old_width;
// guint old_height;
guint char_width;
guint char_height;
@ -108,7 +108,7 @@ struct _MooTermPrivate {
};
inline static gulong term_top_line (MooTerm *term)
inline static guint term_top_line (MooTerm *term)
{
if (term->priv->scrolled)
return term->priv->_top_line;
@ -116,12 +116,12 @@ inline static gulong term_top_line (MooTerm *term)
return buf_screen_offset (term->priv->buffer);
}
inline static gulong term_width (MooTerm *term)
inline static guint term_width (MooTerm *term)
{
return buf_screen_width (term->priv->buffer);
}
inline static gulong term_height (MooTerm *term)
inline static guint term_height (MooTerm *term)
{
return buf_screen_height (term->priv->buffer);
}
@ -129,8 +129,8 @@ inline static gulong term_height (MooTerm *term)
void moo_term_buf_content_changed(MooTerm *term);
void moo_term_cursor_moved (MooTerm *term,
gulong old_row,
gulong old_col);
guint old_row,
guint old_col);
void moo_term_size_changed (MooTerm *term);
void moo_term_init_font_stuff (MooTerm *term);
@ -163,7 +163,7 @@ inline static void moo_term_invalidate_all (MooTerm *term)
struct _TermPangoLines
{
gulong size;
guint size;
GPtrArray *screen;
GByteArray *valid;
PangoLayout *line;
@ -171,7 +171,7 @@ struct _TermPangoLines
};
inline static PangoLayout *term_pango_line (MooTerm *term,
gulong i)
guint i)
{
g_assert (i < term->priv->pango_lines->size);
return (PangoLayout*) term->priv->pango_lines->screen->pdata[i];
@ -181,17 +181,17 @@ TermPangoLines *term_pango_lines_new (PangoContext *ctx);
void term_pango_lines_free (TermPangoLines *lines);
void term_pango_lines_resize (MooTerm *term,
gulong size);
guint size);
void term_pango_lines_set_font (TermPangoLines *lines,
PangoFontDescription *font);
gboolean term_pango_lines_valid (TermPangoLines *lines,
gulong row);
guint row);
void term_pango_lines_set_text (TermPangoLines *lines,
gulong row,
guint row,
const char *text,
int len);
void term_pango_lines_invalidate (MooTerm *term,
gulong row);
guint row);
void term_pango_lines_invalidate_all (MooTerm *term);
@ -224,26 +224,26 @@ enum {
#define SELECT_SCROLL_DOWN (1)
struct _TermSelection {
gulong screen_width;
guint screen_width;
// absolute coordinates in the buffer
// selected range is [(l_row, l_col), (r_row, r_col))
// l_row, l_col and r_row are valid
// r_col may be equal to _width
gulong l_row;
gulong l_col;
gulong r_row;
gulong r_col;
guint l_row;
guint l_col;
guint r_row;
guint r_col;
gboolean empty;
gboolean button_pressed;
int click;
gboolean drag;
// buffer coordinates
gulong drag_begin_row;
gulong drag_begin_col;
gulong drag_end_row;
gulong drag_end_col;
guint drag_begin_row;
guint drag_begin_col;
guint drag_end_row;
guint drag_end_col;
int scroll;
guint st_id;
@ -257,21 +257,21 @@ inline static void term_selection_free (TermSelection *sel)
}
void term_set_selection (MooTerm *term,
gulong row1,
gulong col1,
gulong row2,
gulong col2);
guint row1,
guint col1,
guint row2,
guint col2);
void term_selection_clear (MooTerm *term);
inline static void term_selection_set_width (MooTerm *term,
gulong width)
guint width)
{
term->priv->selection->screen_width = width;
term_selection_clear (term);
}
inline static int term_selection_row_selected (TermSelection *sel,
gulong row)
guint row)
{
if (sel->empty || sel->r_row < row || row < sel->l_row)
return NOT_SELECTED;
@ -282,8 +282,8 @@ inline static int term_selection_row_selected (TermSelection *sel,
}
inline static gboolean term_selected (TermSelection *sel,
gulong row,
gulong col)
guint row,
guint col)
{
if (sel->empty || sel->r_row < row || row < sel->l_row)
return FALSE;

View File

@ -52,7 +52,7 @@ static void queue_adjustment_value_changed (MooTerm *term);
static gboolean emit_adjustment_changed (MooTerm *term);
static gboolean emit_adjustment_value_changed (MooTerm *term);
static void scroll_abs (MooTerm *term,
gulong line,
guint line,
gboolean update_adj);
static void scroll_to_bottom (MooTerm *term,
gboolean update_adj);
@ -350,7 +350,7 @@ void moo_term_set_adjustment (MooTerm *term,
static void scrollback_changed (MooTerm *term)
{
gulong scrollback = buf_screen_offset (term->priv->buffer);
guint scrollback = buf_screen_offset (term->priv->buffer);
if (term->priv->scrolled && term->priv->_top_line > scrollback)
scroll_to_bottom (term, TRUE);
@ -412,12 +412,12 @@ static void update_adjustment (MooTerm *term)
static void update_adjustment_value (MooTerm *term)
{
gulong value = term_top_line (term);
guint value = term_top_line (term);
if (!term->priv->adjustment)
return;
if ((gulong)term->priv->adjustment->value != value)
if (term->priv->adjustment->value != value)
{
term->priv->adjustment->value = value;
queue_adjustment_value_changed (term);
@ -427,7 +427,7 @@ static void update_adjustment_value (MooTerm *term)
static void adjustment_value_changed (MooTerm *term)
{
gulong val, real_val;
guint val, real_val;
g_assert (term->priv->adjustment != NULL);
@ -493,7 +493,7 @@ static gboolean emit_adjustment_value_changed (MooTerm *term)
static void scroll_abs (MooTerm *term,
gulong line,
guint line,
gboolean update_adj)
{
if (term_top_line (term) == line)
@ -615,8 +615,8 @@ void moo_term_set_buffer (MooTerm *term,
{
GtkWidget *widget = GTK_WIDGET (term);
TermFontInfo *font_info = term->priv->font_info;
gulong width = widget->allocation.width / font_info->width;
gulong height = widget->allocation.height / font_info->height;
guint width = widget->allocation.width / font_info->width;
guint height = widget->allocation.height / font_info->height;
term_pango_lines_invalidate_all (term);
term->priv->scrolled = FALSE;
@ -637,8 +637,8 @@ void moo_term_size_changed (MooTerm *term)
{
GtkWidget *widget = GTK_WIDGET (term);
TermFontInfo *font_info = term->priv->font_info;
gulong width, height;
gulong old_width, old_height;
guint width, height;
guint old_width, old_height;
width = widget->allocation.width / font_info->width;
height = widget->allocation.height / font_info->height;

View File

@ -108,39 +108,38 @@ enum {
KEYPAD_NUMERIC = 1 << 15
};
#define ANSI_MODES (KAM | IRM | LNM)
#define DEC_MODES (DECCKM | DECANM | DECCOLM | DECSCLM | DECSCNM | DECOM | DECAWM | DECARM | DECPFF | DECPEX)
/* LNM mode affects also data sent by RETURN */
struct _MooTermBufferPrivate {
gboolean constructed;
GArray *lines; /* array of MooTermLine */
GPtrArray *lines; /* array of MooTermLine* */
int modes;
int saved_modes;
MooTermTextAttr current_attr;
gboolean cursor_visible;
gulong screen_offset;
gulong screen_width;
gulong screen_height;
guint screen_offset;
guint screen_width;
guint screen_height;
/* scrolling region - top and bottom rows */
gulong top_margin;
gulong bottom_margin;
guint top_margin;
guint bottom_margin;
gboolean scrolling_region_set;
/* always absolute */
gulong cursor_row;
gulong cursor_col;
guint cursor_row;
guint cursor_col;
/* used for save_cursor/restore_cursor */
gulong saved_cursor_row;
gulong saved_cursor_col;
guint saved_cursor_row;
guint saved_cursor_col;
glong max_height;
GList *tab_stops;
int max_height;
MooTermParser *parser;
BufRegion *changed;
@ -151,49 +150,55 @@ struct _MooTermBufferPrivate {
};
inline static gulong buf_screen_width (MooTermBuffer *buf)
inline static guint buf_screen_width (MooTermBuffer *buf)
{
return buf->priv->screen_width;
}
inline static gulong buf_screen_height (MooTermBuffer *buf)
inline static guint buf_screen_height (MooTermBuffer *buf)
{
return buf->priv->screen_height;
}
inline static gulong buf_screen_offset (MooTermBuffer *buf)
inline static guint buf_screen_offset (MooTermBuffer *buf)
{
return buf->priv->screen_offset;
}
inline static gulong buf_total_height (MooTermBuffer *buf)
inline static guint buf_total_height (MooTermBuffer *buf)
{
return buf->priv->screen_height + buf->priv->screen_offset;
}
inline static MooTermLine *buf_line (MooTermBuffer *buf, gulong i)
inline static MooTermLine *buf_line (MooTermBuffer *buf, guint i)
{
return &g_array_index (buf->priv->lines, MooTermLine, i);
g_assert (buf->priv->lines->len ==
buf->priv->screen_height + buf->priv->screen_offset);
g_assert (i < buf->priv->screen_height +
buf->priv->screen_offset);
return g_ptr_array_index (buf->priv->lines, i);
}
inline static MooTermLine *buf_screen_line (MooTermBuffer *buf, gulong line)
inline static MooTermLine *buf_screen_line (MooTermBuffer *buf, guint i)
{
g_assert (line < buf->priv->screen_height);
return &g_array_index (buf->priv->lines, MooTermLine,
line + buf->priv->screen_offset);
g_assert (i < buf->priv->screen_height);
return g_ptr_array_index (buf->priv->lines,
i + buf->priv->screen_offset);
}
inline static gulong buf_cursor_row_abs (MooTermBuffer *buf)
inline static guint buf_cursor_row_abs (MooTermBuffer *buf)
{
return buf->priv->screen_offset + buf->priv->cursor_row;
}
inline static gulong buf_cursor_row (MooTermBuffer *buf)
inline static guint buf_cursor_row (MooTermBuffer *buf)
{
return buf->priv->cursor_row;
}
inline static gulong buf_cursor_col (MooTermBuffer *buf)
inline static guint buf_cursor_col (MooTermBuffer *buf)
{
return buf->priv->cursor_col;
}
@ -234,9 +239,9 @@ inline static void buf_changed_set_all (MooTermBuffer *buf)
}
inline static void buf_changed_add_range (MooTermBuffer *buf,
gulong row,
gulong start,
gulong len)
guint row,
guint start,
guint len)
{
BufRectangle rec = {start, row, len, 1};
buf_changed_add_rectangle (buf, &rec);
@ -253,21 +258,6 @@ inline static void buf_changed_clear (MooTermBuffer *buf)
buf->priv->changed_all = FALSE;
}
inline static char *buf_screen_get_text (MooTermBuffer *buf)
{
guint i;
GString *s = g_string_new ("");
for (i = 0; i < buf_screen_height (buf); ++i)
{
g_string_append_len (s, term_line_chars (buf_screen_line (buf, i)),
term_line_len (buf_screen_line (buf, i)));
g_string_append_c (s, '\n');
}
return g_string_free (s, FALSE);
}
inline static gboolean buf_cursor_visible (MooTermBuffer *buf)
{
return buf->priv->cursor_visible;
@ -301,9 +291,8 @@ inline static void _buf_add_lines (MooTermBuffer *buf,
for (i = 0; i < num; ++i)
{
MooTermLine new_line;
term_line_init (&new_line, 1);
g_array_append_val (buf->priv->lines, new_line);
g_ptr_array_add (buf->priv->lines,
term_line_new (buf->priv->screen_width));
buf->priv->screen_offset++;
}
}
@ -313,12 +302,14 @@ inline static void _buf_delete_lines (MooTermBuffer *buf,
{
guint i;
g_return_if_fail (num != 0 && num < buf->priv->screen_offset);
for (i = 0; i < num; ++i)
{
term_line_destroy (buf_line (buf, buf->priv->lines->len - 1));
g_array_set_size (buf->priv->lines, buf->priv->lines->len - 1);
buf->priv->screen_offset--;
}
term_line_free (buf_line (buf, buf->priv->lines->len - i - 1));
buf->priv->screen_offset -= num;
g_ptr_array_set_size (buf->priv->lines, buf->priv->lines->len - num);
}
@ -335,11 +326,11 @@ void moo_term_buffer_set_font (MooTermBuffer *buf,
const char *font);
void moo_term_buffer_cursor_move (MooTermBuffer *buf,
long rows,
long cols);
int rows,
int cols);
void moo_term_buffer_cursor_move_to (MooTermBuffer *buf,
long row,
long col);
int row,
int col);
void moo_term_buffer_set_keypad_numeric (MooTermBuffer *buf,
gboolean setting);
@ -348,6 +339,14 @@ void moo_term_buffer_index (MooTermBuffer *buf);
void moo_term_buffer_new_line (MooTermBuffer *buf);
void moo_term_buffer_erase_display (MooTermBuffer *buf);
void moo_term_buffer_reset_tab_stops (MooTermBuffer *buf);
void moo_term_buffer_clear_tab_stop (MooTermBuffer *buf);
void moo_term_buffer_set_tab_stop (MooTermBuffer *buf);
guint moo_term_buffer_next_tab_stop (MooTermBuffer *buf,
guint current);
guint moo_term_buffer_prev_tab_stop (MooTermBuffer *buf,
guint current);
/***************************************************************************/
@ -379,24 +378,6 @@ typedef enum {
} AnsiTextAttr;
inline static gulong buf_compute_next_tab_stop (G_GNUC_UNUSED MooTermBuffer *buf,
gulong col)
{
return ((col >> 3) << 3) + 8;
}
inline static gulong buf_compute_prev_tab_stop (G_GNUC_UNUSED MooTermBuffer *buf,
gulong col)
{
if (!col)
return col;
else if (col & 7)
return (col >> 3) << 3;
else
return col - 8;
}
G_END_DECLS
#endif /* MOOTERM_MOOTERMBUFFER_PRIVATE_H */

View File

@ -124,12 +124,12 @@ inline static void buf_vt_ich (MooTermBuffer *buf,
if (num > screen_width - cursor_col)
num = screen_width - cursor_col;
term_line_insert_chars (buf_screen_line (buf, cursor_row),
cursor_col,
EMPTY_CHAR,
num,
screen_width,
&buf->priv->current_attr);
term_line_insert_unichar (buf_screen_line (buf, cursor_row),
cursor_col,
EMPTY_CHAR,
num,
&buf->priv->current_attr,
screen_width);
buf_changed_add_rectangle (buf, &changed);
moo_term_buffer_changed (buf);
@ -239,8 +239,7 @@ inline static void buf_vt_erase_from_cursor (MooTermBuffer *buf)
term_line_erase_range (buf_screen_line (buf, cursor_row),
cursor_col,
screen_width,
&ZERO_ATTR);
screen_width);
for (i = cursor_row + 1; i < screen_height; ++i)
term_line_erase (buf_screen_line (buf, i));
@ -274,8 +273,7 @@ inline static void buf_vt_erase_to_cursor (MooTermBuffer *buf)
term_line_erase_range (buf_screen_line (buf, cursor_row),
0,
cursor_col + 1,
&ZERO_ATTR);
cursor_col + 1);
buf_changed_add_rectangle (buf, &changed);
@ -308,8 +306,7 @@ inline static void buf_vt_erase_line_from_cursor (MooTermBuffer *buf)
term_line_erase_range (buf_screen_line (buf, cursor_row),
cursor_col,
screen_width,
&ZERO_ATTR);
screen_width);
buf_changed_add_rectangle (buf, &changed);
moo_term_buffer_changed (buf);
@ -325,8 +322,7 @@ inline static void buf_vt_erase_line_to_cursor (MooTermBuffer *buf)
term_line_erase_range (buf_screen_line (buf, cursor_row),
0,
cursor_col + 1,
&ZERO_ATTR);
cursor_col + 1);
buf_changed_add_rectangle (buf, &changed);
moo_term_buffer_changed (buf);
@ -453,24 +449,24 @@ inline static void buf_vt_init_hilite_mouse_tracking (G_GNUC_UNUSED MooTermBu
inline static void buf_vt_clear_tab_stop (G_GNUC_UNUSED MooTermBuffer *buf)
{
g_message ("%s: implement me", G_STRLOC);
moo_term_buffer_clear_tab_stop (buf);
}
inline static void buf_vt_clear_all_tab_stops (G_GNUC_UNUSED MooTermBuffer *buf)
{
g_message ("%s: implement me", G_STRLOC);
moo_term_buffer_reset_tab_stops (buf);
}
inline static void buf_vt_tab (MooTermBuffer *buf)
{
moo_term_buffer_cursor_move_to (buf, -1,
buf_compute_next_tab_stop (buf,
buf_cursor_col (buf)));
moo_term_buffer_next_tab_stop (buf,
buf_cursor_col (buf)));
}
inline static void buf_vt_set_tab_stop (G_GNUC_UNUSED MooTermBuffer *buf)
{
g_message ("%s: implement me", G_STRLOC);
moo_term_buffer_set_tab_stop (buf);
}
@ -531,18 +527,20 @@ inline static void buf_vt_il (MooTermBuffer *buf,
{
guint i;
gpointer dest = &g_array_index (buf->priv->lines, MooTermLine,
screen_offset + cursor_row + num + 1);
gpointer src = &g_array_index (buf->priv->lines, MooTermLine,
screen_offset + cursor_row + 1);
gpointer dest = &g_ptr_array_index (buf->priv->lines,
screen_offset + cursor_row + num + 1);
gpointer src = &g_ptr_array_index (buf->priv->lines,
screen_offset + cursor_row + 1);
for (i = 0; i < num; ++i)
term_line_destroy (buf_screen_line (buf, bottom - i));
term_line_free (buf_screen_line (buf, bottom - i));
memmove (dest, src, sizeof (MooTermLine) * (bottom - cursor_row - 1));
memmove (dest, src, sizeof (MooTermLine*) * (bottom - cursor_row - 1));
for (i = 0; i < num; ++i)
term_line_init (buf_screen_line (buf, cursor_row + 1 + i), width);
g_ptr_array_index (buf->priv->lines,
screen_offset + cursor_row + 1 + i) =
term_line_new (width);
}
buf_changed_add_rectangle (buf, &changed);
@ -576,24 +574,25 @@ inline static void buf_vt_dl (MooTermBuffer *buf,
{
guint i;
for (i = 0; i < bottom - cursor_row + 1; ++i)
term_line_erase (buf_screen_line (buf, cursor_row + i));
term_line_free (buf_screen_line (buf, cursor_row + i));
}
else
{
guint i;
gpointer dest = &g_array_index (buf->priv->lines, MooTermLine,
screen_offset + cursor_row);
gpointer src = &g_array_index (buf->priv->lines, MooTermLine,
screen_offset + cursor_row + num);
gpointer dest = &g_ptr_array_index (buf->priv->lines,
screen_offset + cursor_row);
gpointer src = &g_ptr_array_index (buf->priv->lines,
screen_offset + cursor_row + num);
for (i = 0; i < num; ++i)
term_line_destroy (buf_screen_line (buf, cursor_row + i));
term_line_free (buf_screen_line (buf, cursor_row + i));
memmove (dest, src, sizeof (MooTermLine) * (bottom - cursor_row + 1 - num));
memmove (dest, src, sizeof (MooTermLine*) * (bottom - cursor_row + 1 - num));
for (i = 0; i < num; ++i)
term_line_init (buf_screen_line (buf, bottom - i), width);
g_ptr_array_index (buf->priv->lines, screen_offset + bottom - i) =
term_line_new (width);
}
buf_changed_add_rectangle (buf, &changed);
@ -608,9 +607,10 @@ inline static void buf_vt_decaln (MooTermBuffer *buf)
guint width = buf_screen_width (buf);
for (i = 0; i < height; ++i)
term_line_insert_chars (buf_screen_line (buf, i),
0, 'S', width, width,
&buf->priv->current_attr);
term_line_set_unichar (buf_screen_line (buf, i), 0,
'S', width,
&buf->priv->current_attr,
width);
}

View File

@ -17,8 +17,8 @@
#include "mooutils/moomarshals.h"
#define MIN_WIDTH (10L)
#define MIN_HEIGHT (10L)
#define MIN_WIDTH (10)
#define MIN_HEIGHT (10)
static void moo_term_buffer_set_property (GObject *object,
guint prop_id,
@ -97,9 +97,9 @@ static void moo_term_buffer_class_init (MooTermBufferClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MooTermBufferClass, cursor_moved),
NULL, NULL,
_moo_marshal_VOID__ULONG_ULONG,
_moo_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_ULONG, G_TYPE_ULONG);
G_TYPE_UINT, G_TYPE_UINT);
signals[BELL] =
g_signal_new ("bell",
@ -116,9 +116,9 @@ static void moo_term_buffer_class_init (MooTermBufferClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MooTermBufferClass, screen_size_changed),
NULL, NULL,
_moo_marshal_VOID__ULONG_ULONG,
_moo_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_ULONG, G_TYPE_ULONG);
G_TYPE_UINT, G_TYPE_UINT);
signals[SET_WINDOW_TITLE] =
g_signal_new ("set-window-title",
@ -162,7 +162,7 @@ static void moo_term_buffer_class_init (MooTermBufferClass *klass)
g_object_class_install_property (gobject_class,
PROP_SCREEN_WIDTH,
g_param_spec_ulong ("screen-width",
g_param_spec_uint ("screen-width",
"screen-width",
"screen-width",
0, 1000000, 80,
@ -170,7 +170,7 @@ static void moo_term_buffer_class_init (MooTermBufferClass *klass)
g_object_class_install_property (gobject_class,
PROP_SCREEN_HEIGHT,
g_param_spec_ulong ("screen-height",
g_param_spec_uint ("screen-height",
"screen-height",
"screen-height",
0, 1000000, 24,
@ -178,7 +178,7 @@ static void moo_term_buffer_class_init (MooTermBufferClass *klass)
g_object_class_install_property (gobject_class,
PROP_MAX_SCROLLBACK,
g_param_spec_long ("max-scrollback",
g_param_spec_int ("max-scrollback",
"max-scrollback",
"max-scrollback",
-1, 1000000, -1,
@ -186,7 +186,7 @@ static void moo_term_buffer_class_init (MooTermBufferClass *klass)
g_object_class_install_property (gobject_class,
PROP_SCROLLBACK,
g_param_spec_ulong ("scrollback",
g_param_spec_uint ("scrollback",
"scrollback",
"scrollback",
0, 1000000, 0,
@ -286,7 +286,7 @@ static void moo_term_buffer_init (MooTermBuffer *buf)
{
buf->priv = g_new0 (MooTermBufferPrivate, 1);
buf->priv->lines = g_array_new (FALSE, FALSE, sizeof(MooTermLine));
buf->priv->lines = g_ptr_array_new ();
buf->priv->changed = NULL;
buf->priv->changed_all = FALSE;
buf->priv->parser = moo_term_parser_new (buf);
@ -299,10 +299,14 @@ static void moo_term_buffer_finalize (GObject *object)
MooTermBuffer *buf = MOO_TERM_BUFFER (object);
for (i = 0; i < buf->priv->lines->len; ++i)
term_line_destroy (buf_line (buf, i));
g_array_free (buf->priv->lines, TRUE);
term_line_free (buf_line (buf, i));
g_ptr_array_free (buf->priv->lines, TRUE);
g_list_free (buf->priv->tab_stops);
if (buf->priv->changed)
buf_region_destroy (buf->priv->changed);
moo_term_parser_free (buf->priv->parser);
g_free (buf->priv);
@ -330,23 +334,23 @@ static void moo_term_buffer_set_property (GObject *object,
switch (prop_id) {
case PROP_SCREEN_WIDTH:
if (buf->priv->constructed)
moo_term_buffer_set_screen_size (buf, g_value_get_ulong (value), 0);
moo_term_buffer_set_screen_size (buf, g_value_get_uint (value), 0);
else
buf->priv->screen_width = g_value_get_ulong (value);
buf->priv->screen_width = g_value_get_uint (value);
break;
case PROP_SCREEN_HEIGHT:
if (buf->priv->constructed)
moo_term_buffer_set_screen_size (buf, 0, g_value_get_ulong (value));
moo_term_buffer_set_screen_size (buf, 0, g_value_get_uint (value));
else
buf->priv->screen_height = g_value_get_ulong (value);
buf->priv->screen_height = g_value_get_uint (value);
break;
case PROP_MAX_SCROLLBACK:
if (buf->priv->constructed)
moo_term_buffer_set_max_scrollback (buf, g_value_get_long (value));
moo_term_buffer_set_max_scrollback (buf, g_value_get_int (value));
else
buf->priv->max_height = g_value_get_long (value);
buf->priv->max_height = g_value_get_int (value);
break;
case PROP_CURSOR_VISIBLE:
@ -392,7 +396,7 @@ static void moo_term_buffer_set_property (GObject *object,
set_mode (buf->priv->modes, HILITE_MOUSE_TRACKING, g_value_get_boolean (value));
g_object_notify (G_OBJECT (buf), "mode-HILITE-MOUSE-TRACKING");
break;
case PROP_MODE_KEYPAD_NUMERIC:
set_mode (buf->priv->modes, KEYPAD_NUMERIC, g_value_get_boolean (value));
g_object_notify (G_OBJECT (buf), "mode-KEYPAD-NUMERIC");
@ -414,19 +418,19 @@ static void moo_term_buffer_get_property (GObject *object,
switch (prop_id) {
case PROP_SCREEN_WIDTH:
g_value_set_ulong (value, buf->priv->screen_width);
g_value_set_uint (value, buf->priv->screen_width);
break;
case PROP_SCREEN_HEIGHT:
g_value_set_ulong (value, buf->priv->screen_height);
g_value_set_uint (value, buf->priv->screen_height);
break;
case PROP_SCROLLBACK:
g_value_set_ulong (value, buf_screen_offset (buf));
g_value_set_uint (value, buf_screen_offset (buf));
break;
case PROP_MAX_SCROLLBACK:
g_value_set_long (value, buf->priv->max_height);
g_value_set_int (value, buf->priv->max_height);
break;
case PROP_CURSOR_VISIBLE:
@ -510,9 +514,8 @@ static GObject *moo_term_buffer_constructor (GType type,
for (i = 0; i < buf->priv->screen_height; ++i)
{
MooTermLine line;
term_line_init (&line, buf->priv->screen_width);
g_array_append_val (buf->priv->lines, line);
g_ptr_array_add (buf->priv->lines,
term_line_new (buf->priv->screen_width));
}
return object;
@ -546,7 +549,7 @@ void moo_term_buffer_scrollback_changed (MooTermBuffer *buf)
static void buf_set_screen_width (MooTermBuffer *buf,
gulong width)
guint width)
{
buf->priv->screen_width = width;
@ -558,16 +561,18 @@ static void buf_set_screen_width (MooTermBuffer *buf,
width,
buf_screen_height (buf));
moo_term_buffer_reset_tab_stops (buf);
buf_changed_set_all (buf);
moo_term_buffer_changed (buf);
}
static void buf_set_screen_height (MooTermBuffer *buf,
gulong height)
guint height)
{
gulong old_height = buf_screen_height (buf);
gulong width = buf_screen_width (buf);
guint old_height = buf_screen_height (buf);
guint width = buf_screen_width (buf);
buf->priv->screen_height = height;
@ -579,15 +584,12 @@ static void buf_set_screen_height (MooTermBuffer *buf,
guint i;
for (i = 0; i < add; ++i)
{
MooTermLine new_line;
term_line_init (&new_line, width);
g_array_append_val (buf->priv->lines, new_line);
}
g_ptr_array_add (buf->priv->lines,
term_line_new (width));
if (buf->priv->screen_offset)
{
gulong cursor_row =
guint cursor_row =
buf->priv->screen_offset + buf->priv->cursor_row;
buf->priv->screen_offset = 0;
@ -643,8 +645,8 @@ static void buf_set_screen_height (MooTermBuffer *buf,
void moo_term_buffer_set_screen_size (MooTermBuffer *buf,
gulong width,
gulong height)
guint width,
guint height)
{
if (height >= MIN_HEIGHT && height != buf_screen_height (buf))
buf_set_screen_height (buf, height);
@ -655,20 +657,20 @@ void moo_term_buffer_set_screen_size (MooTermBuffer *buf,
void moo_term_buffer_set_max_scrollback (G_GNUC_UNUSED MooTermBuffer *buf,
G_GNUC_UNUSED glong lines)
G_GNUC_UNUSED int lines)
{
g_warning ("%s: implement me", G_STRLOC);
}
void moo_term_buffer_cursor_move (MooTermBuffer *buf,
long rows,
long cols)
int rows,
int cols)
{
long width = buf_screen_width (buf);
long height = buf_screen_height (buf);
long cursor_row = buf_cursor_row (buf);
long cursor_col = buf_cursor_col (buf);
int width = buf_screen_width (buf);
int height = buf_screen_height (buf);
int cursor_row = buf_cursor_row (buf);
int cursor_col = buf_cursor_col (buf);
if (rows && cursor_row + rows >= 0 && cursor_row + rows < height)
cursor_row += rows;
@ -680,8 +682,8 @@ void moo_term_buffer_cursor_move (MooTermBuffer *buf,
static void moo_term_buffer_cursor_moved (MooTermBuffer *buf,
gulong old_row,
gulong old_col)
guint old_row,
guint old_col)
{
if (!buf->priv->freeze_cursor_notify)
g_signal_emit (buf, signals[CURSOR_MOVED], 0,
@ -690,14 +692,14 @@ static void moo_term_buffer_cursor_moved (MooTermBuffer *buf,
void moo_term_buffer_cursor_move_to (MooTermBuffer *buf,
long row,
long col)
int row,
int col)
{
gulong old_row = buf_cursor_row (buf);
gulong old_col = buf_cursor_col (buf);
guint old_row = buf_cursor_row (buf);
guint old_col = buf_cursor_col (buf);
g_return_if_fail (row < (long)buf_screen_height (buf));
g_return_if_fail (col < (long)buf_screen_width (buf));
g_return_if_fail (row < (int) buf_screen_height (buf));
g_return_if_fail (col < (int) buf_screen_width (buf));
if (row < 0)
row = old_row;
@ -713,10 +715,10 @@ void moo_term_buffer_cursor_move_to (MooTermBuffer *buf,
void moo_term_buffer_write (MooTermBuffer *buf,
const char *data,
gssize len)
int len)
{
gulong old_cursor_row = buf_cursor_row (buf);
gulong old_cursor_col = buf_cursor_col (buf);
guint old_cursor_row = buf_cursor_row (buf);
guint old_cursor_col = buf_cursor_col (buf);
buf_freeze_changed_notify (buf);
buf_freeze_cursor_notify (buf);
@ -731,70 +733,95 @@ void moo_term_buffer_write (MooTermBuffer *buf,
}
static void buf_print_char (MooTermBuffer *buf,
char c)
/* chars must be valid unicode string */
static void buf_print_chars_real (MooTermBuffer *buf,
const char *chars,
guint len)
{
gulong width = buf_screen_width (buf);
gulong cursor_row = buf_cursor_row (buf);
guint width = buf_screen_width (buf);
guint cursor_row = buf_cursor_row (buf);
MooTermTextAttr *attr =
buf->priv->current_attr.mask ? &buf->priv->current_attr : NULL;
if (buf->priv->modes & IRM)
const char *p = chars;
const char *end = chars + len;
g_assert (p < end);
for (p = chars; p < end; p = g_utf8_next_char (p))
{
term_line_insert_char (buf_screen_line (buf, cursor_row),
buf->priv->cursor_col++,
c, attr, width);
buf_changed_add_range (buf, cursor_row,
buf->priv->cursor_col - 1,
width - buf->priv->cursor_col + 1);
}
else
{
term_line_set_char (buf_screen_line (buf, cursor_row),
buf->priv->cursor_col++,
c, attr, width);
buf_changed_add_range (buf, cursor_row,
buf->priv->cursor_col - 1, 1);
}
gunichar c = g_utf8_get_char (p);
if (buf->priv->cursor_col == width)
{
buf->priv->cursor_col--;
if (buf->priv->modes & DECAWM)
moo_term_buffer_new_line (buf);
}
}
void moo_term_buffer_print_chars (MooTermBuffer *buf,
const char *chars,
gssize len)
{
gsize i;
if (!len)
return;
for (i = 0; (len < 0 && chars[i]) || (len > 0 && i < (gsize)len); ++i)
{
char c = chars[i];
if (c & '\200' || (' ' <= c && c <= '~'))
buf_print_char (buf, c);
else if (c == '\127')
buf_print_char (buf, '~');
if (buf->priv->modes & IRM)
{
term_line_insert_unichar (buf_screen_line (buf, cursor_row),
buf->priv->cursor_col++,
c, 1, attr, width);
buf_changed_add_range (buf, cursor_row,
buf->priv->cursor_col - 1,
width - buf->priv->cursor_col + 1);
}
else
{
buf_print_char (buf, '^');
buf_print_char (buf, c + 0100);
term_line_set_unichar (buf_screen_line (buf, cursor_row),
buf->priv->cursor_col++,
c, 1, attr, width);
buf_changed_add_range (buf, cursor_row,
buf->priv->cursor_col - 1, 1);
}
if (buf->priv->cursor_col == width)
{
buf->priv->cursor_col--;
if (buf->priv->modes & DECAWM)
moo_term_buffer_new_line (buf);
}
}
}
MooTermBuffer *moo_term_buffer_new (gulong width,
gulong height)
/* chars must be valid unicode string */
void moo_term_buffer_print_chars (MooTermBuffer *buf,
const char *chars,
int len)
{
const char *p = chars;
const char *s;
g_return_if_fail (len != 0 && chars != NULL);
while ((len > 0 && p != chars + len) || (len < 0 && *p != 0))
{
for (s = p; ((len > 0 && s != chars + len) || (len < 0 && *s != 0))
&& *s && (*s & 0x80 || (' ' <= *s && *s <= '~')); ++s) ;
if (s != p)
{
buf_print_chars_real (buf, p, s - p);
p = s;
}
else if (!*s)
{
++p;
}
else if (*s == 0x7F)
{
buf_print_chars_real (buf, "~", -1);
++p;
}
else
{
static char ar[2] = {'^'};
ar[1] = *s + 0x40;
buf_print_chars_real (buf, ar, 2);
}
}
}
MooTermBuffer *moo_term_buffer_new (guint width,
guint height)
{
return MOO_TERM_BUFFER (g_object_new (MOO_TYPE_TERM_BUFFER,
"screen-width", width,
@ -903,3 +930,75 @@ void moo_term_buffer_set_keypad_numeric (MooTermBuffer *buf,
g_object_notify (G_OBJECT (buf), "mode-KEYPAD-NUMERIC");
}
void moo_term_buffer_reset_tab_stops (MooTermBuffer *buf)
{
guint i;
guint width = buf_screen_width (buf);
g_list_free (buf->priv->tab_stops);
buf->priv->tab_stops = NULL;
for (i = 0; i < (width + 7) / 8; ++i)
buf->priv->tab_stops = g_list_append (buf->priv->tab_stops,
GUINT_TO_POINTER (8 * i));
}
guint moo_term_buffer_next_tab_stop (MooTermBuffer *buf,
guint current)
{
GList *l;
for (l = buf->priv->tab_stops;
l != NULL && GPOINTER_TO_UINT (l->data) <= current;
l = l->next) ;
if (l && GPOINTER_TO_UINT (l->data) > current)
return GPOINTER_TO_UINT (l->data);
else
return buf_screen_width (buf) - 1;
}
guint moo_term_buffer_prev_tab_stop (MooTermBuffer *buf,
guint current)
{
GList *l;
for (l = buf->priv->tab_stops;
l != NULL && GPOINTER_TO_UINT (l->data) < current;
l = l->next) ;
if (l && l->prev && GPOINTER_TO_UINT (l->prev->data) < current)
return GPOINTER_TO_UINT (l->prev->data);
else
return 0;
}
void moo_term_buffer_clear_tab_stop (MooTermBuffer *buf)
{
buf->priv->tab_stops =
g_list_remove (buf->priv->tab_stops,
GUINT_TO_POINTER (buf_cursor_col (buf)));
}
static int cmp_guints (gconstpointer a, gconstpointer b)
{
if (GPOINTER_TO_UINT (a) < GPOINTER_TO_UINT (b))
return -1;
else if (a == b)
return 0;
else
return 1;
}
void moo_term_buffer_set_tab_stop (MooTermBuffer *buf)
{
guint cursor = buf_cursor_col (buf);
if (!g_list_find (buf->priv->tab_stops, GUINT_TO_POINTER (cursor)))
buf->priv->tab_stops =
g_list_insert_sorted (buf->priv->tab_stops,
GUINT_TO_POINTER (cursor),
cmp_guints);
}

View File

@ -75,11 +75,11 @@ struct _MooTermBufferClass {
void (*changed) (MooTermBuffer *buf);
void (*screen_size_changed) (MooTermBuffer *buf,
gulong width,
gulong height);
guint width,
guint height);
void (*cursor_moved) (MooTermBuffer *buf,
gulong old_row,
gulong old_col);
guint old_row,
guint old_col);
void (*bell) (MooTermBuffer *buf);
void (*set_window_title) (MooTermBuffer *buf,
@ -98,14 +98,14 @@ GType moo_term_text_attr_mask_get_type (void) G_GNUC_CONST;
GType moo_term_text_attr_get_type (void) G_GNUC_CONST;
GType moo_term_buffer_get_type (void) G_GNUC_CONST;
MooTermBuffer *moo_term_buffer_new (gulong width,
gulong height);
MooTermBuffer *moo_term_buffer_new (guint width,
guint height);
void moo_term_buffer_set_screen_size (MooTermBuffer *buf,
gulong width,
gulong height);
guint width,
guint height);
void moo_term_buffer_set_max_scrollback (MooTermBuffer *buf,
glong lines);
int lines);
void moo_term_buffer_set_cursor_visible (MooTermBuffer *buf,
gboolean visible);
@ -115,10 +115,10 @@ void moo_term_buffer_scrollback_changed (MooTermBuffer *buf);
void moo_term_buffer_print_chars (MooTermBuffer *buf,
const char *chars,
gssize len);
int len);
void moo_term_buffer_write (MooTermBuffer *buf,
const char *data,
gssize len);
int len);
G_END_DECLS

View File

@ -144,7 +144,7 @@ void term_pango_lines_free (TermPangoLines *lines)
void term_pango_lines_resize (MooTerm *term,
gulong size)
guint size)
{
guint i;
TermPangoLines *lines = term->priv->pango_lines;
@ -189,7 +189,7 @@ void term_pango_lines_set_font (TermPangoLines *lines,
gboolean term_pango_lines_valid (TermPangoLines *lines,
gulong i)
guint i)
{
g_assert (i < lines->size);
return lines->valid->data[i];
@ -197,7 +197,7 @@ gboolean term_pango_lines_valid (TermPangoLines *lines,
void term_pango_lines_invalidate (MooTerm *term,
gulong i)
guint i)
{
TermPangoLines *lines = term->priv->pango_lines;
g_assert (i < lines->size);
@ -215,7 +215,7 @@ void term_pango_lines_invalidate_all (MooTerm *term)
void term_pango_lines_set_text (TermPangoLines *lines,
gulong i,
guint i,
const char *text,
int len)
{
@ -306,17 +306,16 @@ static void queue_expose (MooTerm *term,
/* interval [first, last) */
inline static void draw_range_simple (MooTerm *term,
gulong abs_row,
gulong first,
gulong last,
gboolean selected)
inline static void draw_range_simple (MooTerm *term,
guint abs_row,
guint first,
guint last,
gboolean selected)
{
MooTermLine *line;
int screen_row = abs_row - term_top_line (term);
char *text = NULL;
int size;
static char b[MAX_TERMINAL_WIDTH];
static char text[8 * MAX_TERMINAL_WIDTH];
PangoLayout *l;
GtkWidget *widget = GTK_WIDGET (term);
@ -332,23 +331,23 @@ inline static void draw_range_simple (MooTerm *term,
{
if ((int)first < size)
{
memcpy (b, term_line_chars (line) + first, size - first);
memset (b + size - first, EMPTY_CHAR, last - size);
guint chars_len = term_line_get_chars (line, text, first, size - first);
memset (text + chars_len, EMPTY_CHAR, last - size);
size = chars_len + last - size;
}
else
{
memset (b, EMPTY_CHAR, last - first);
memset (text, EMPTY_CHAR, last - first);
size = last - first;
}
text = b;
}
else
{
text = term_line_chars (line) + first;
size = term_line_get_chars (line, text, first, size - first);
}
l = term->priv->pango_lines->line;
pango_layout_set_text (l, text, last - first);
pango_layout_set_text (l, text, size);
gdk_draw_rectangle (widget->window,
term->priv->bg[selected ? SELECTED : NORMAL],
@ -366,9 +365,9 @@ inline static void draw_range_simple (MooTerm *term,
/* interval [first, last) */
inline static void draw_range (MooTerm *term, gulong abs_row, gulong first, gulong last)
inline static void draw_range (MooTerm *term, guint abs_row, guint first, guint last)
{
gulong screen_width = term_width (term);
guint screen_width = term_width (term);
TermSelection *sel = term->priv->selection;
int selected;
@ -389,10 +388,10 @@ inline static void draw_range (MooTerm *term, gulong abs_row, gulong first, gulo
case PART_SELECTED:
{
gulong l_row = sel->l_row;
gulong l_col = sel->l_col;
gulong r_row = sel->r_row;
gulong r_col = sel->r_col;
guint l_row = sel->l_row;
guint l_col = sel->l_col;
guint r_row = sel->r_row;
guint r_col = sel->r_col;
if (l_row == r_row)
{
@ -479,18 +478,19 @@ inline static void draw_range (MooTerm *term, gulong abs_row, gulong first, gulo
}
inline static void draw_caret (MooTerm *term, gulong abs_row, gulong col)
inline static void draw_caret (MooTerm *term, guint abs_row, guint col)
{
gulong screen_width = term_width (term);
guint screen_width = term_width (term);
MooTermLine *line = buf_line (term->priv->buffer, abs_row);
TermSelection *sel = term->priv->selection;
char c;
char ch[6];
guint ch_len;
int screen_row = abs_row - term_top_line (term);
PangoLayout *l;
GdkGC **fg = term->priv->fg;
GdkGC **bg = term->priv->bg;
gulong char_width = term->priv->font_info->width;
gulong char_height = term->priv->font_info->height;
guint char_width = term->priv->font_info->width;
guint char_height = term->priv->font_info->height;
GtkWidget *widget = GTK_WIDGET (term);
g_assert (col < screen_width);
@ -499,9 +499,18 @@ inline static void draw_caret (MooTerm *term, gulong abs_row, gulong col)
return;
/* return draw_range (term, abs_row, col, col + 1); */
c = term_line_get_char (line, col);
if (col < term_line_len (line))
{
ch_len = g_unichar_to_utf8 (term_line_get_unichar (line, col), ch);
}
else
{
ch[0] = EMPTY_CHAR;
ch_len = 1;
}
l = term->priv->pango_lines->line;
pango_layout_set_text (l, &c, 1);
pango_layout_set_text (l, ch, ch_len);
switch (term->priv->caret_shape)
{
@ -579,7 +588,7 @@ inline static void draw_caret (MooTerm *term, gulong abs_row, gulong col)
}
inline static void draw_line (MooTerm *term, gulong abs_row)
inline static void draw_line (MooTerm *term, guint abs_row)
{
MooTermLine *line = buf_line (term->priv->buffer, abs_row);
TermSelection *sel = term->priv->selection;
@ -597,16 +606,16 @@ inline static void draw_line (MooTerm *term, gulong abs_row)
guint char_height = term->priv->font_info->height;
g_assert (0 <= screen_row);
g_assert ((gulong)screen_row < term_height (term));
g_assert (screen_row < (int) term_height (term));
if (!term_pango_lines_valid (term->priv->pango_lines,
screen_row))
{
const char *text = term_line_chars (line);
int len = MIN (term_width (term), term_line_len (line));
char buf[8 * MAX_TERMINAL_WIDTH];
guint buf_len = term_line_get_chars (line, buf, 0, -1);
term_pango_lines_set_text (term->priv->pango_lines,
screen_row,
text, len);
buf, buf_len);
}
gdk_draw_rectangle (widget->window,
@ -628,10 +637,10 @@ inline static void draw_line (MooTerm *term, gulong abs_row)
case PART_SELECTED:
{
gulong l_row = sel->l_row;
gulong l_col = sel->l_col;
gulong r_row = sel->r_row;
gulong r_col = sel->r_col;
guint l_row = sel->l_row;
guint l_col = sel->l_col;
guint r_row = sel->r_row;
guint r_col = sel->r_col;
if (l_row == r_row)
{
@ -753,7 +762,8 @@ gboolean moo_term_expose_event (GtkWidget *widget,
int cursor_col = buf_cursor_col (term->priv->buffer);
GdkRectangle cursor = {
cursor_col, cursor_row_abs - top_line,
cursor_col * char_width,
(cursor_row_abs - top_line) * char_height,
char_width, char_height
};
@ -945,26 +955,23 @@ void moo_term_buf_content_changed(MooTerm *term)
void moo_term_cursor_moved (MooTerm *term,
gulong old_row,
gulong old_col)
guint old_row,
guint old_col)
{
MooTermBuffer *buf = term->priv->buffer;
if (buf_cursor_visible (buf))
{
long screen_offset = buf_screen_offset (buf);
long top_line = term_top_line (term);
int screen_offset = buf_screen_offset (buf);
int top_line = term_top_line (term);
long new_row = buf_cursor_row (buf);
long new_col = buf_cursor_col (buf);
int new_row = buf_cursor_row (buf);
int new_col = buf_cursor_col (buf);
guint char_width = term->priv->font_info->width;
guint char_height = term->priv->font_info->height;
GdkRectangle rect = {0, 0, char_width, char_height};
if (new_row == (long)old_row && new_col == (long)old_col)
return;
rect.x = old_col * char_width;
rect.y = (old_row + screen_offset - top_line) * char_height;
@ -973,10 +980,13 @@ void moo_term_cursor_moved (MooTerm *term,
else
term->priv->dirty = gdk_region_rectangle (&rect);
rect.x = new_col * char_width;
rect.y = (new_row + screen_offset - top_line) * char_height;
if (new_row != (int) old_row || new_col != (int) old_col)
{
rect.x = new_col * char_width;
rect.y = (new_row + screen_offset - top_line) * char_height;
gdk_region_union_with_rect (term->priv->dirty, &rect);
gdk_region_union_with_rect (term->priv->dirty, &rect);
}
queue_expose (term, NULL);
}

View File

@ -19,320 +19,215 @@
#endif
#include <string.h>
#include <glib.h>
G_BEGIN_DECLS
#define EMPTY_CHAR ' '
typedef struct _MooTermCell MooTermCell;
typedef struct _MooTermLine MooTermLine;
#define EMPTY_CHAR ' '
static MooTermTextAttr ZERO_ATTR;
typedef GArray AttrList;
#define TERM_LINE(ar) ((MooTermLine*) (ar))
#define TERM_LINE_ARRAY(line) ((GArray*) (line))
inline static AttrList *attr_list_free (AttrList *attrs)
struct _MooTermCell {
gunichar ch;
MooTermTextAttr attr;
};
struct _MooTermLine {
MooTermCell *data;
guint len;
};
inline static MooTermLine *term_line_new (guint len)
{
if (attrs)
g_array_free (attrs, TRUE);
return NULL;
return TERM_LINE (g_array_sized_new (FALSE, FALSE,
sizeof (MooTermCell),
len));
}
inline static AttrList *attr_list_new (gulong start,
gulong len,
MooTermTextAttr *attr)
{
AttrList *a;
guint i;
if (!len || !attr || !attr->mask)
return NULL;
a = g_array_sized_new (FALSE, FALSE,
sizeof (MooTermTextAttr), start + len);
for (i = 0; i < start; ++i)
g_array_append_val (a, ZERO_ATTR);
for (i = start; i < start + len; ++i)
g_array_append_val (a, *attr);
return a;
}
inline static MooTermTextAttr *attr_list_get_attr (AttrList *list, gulong i)
{
if (!list || i >= list->len)
{
return NULL;
}
else
{
MooTermTextAttr *attr = &g_array_index (list, MooTermTextAttr, i);
if (attr->mask)
return attr;
else
return NULL;
}
}
inline static AttrList *attr_list_set_range (AttrList *list,
gulong start,
gulong len,
MooTermTextAttr *attr)
{
guint i;
guint old_len;
if (!len)
return list;
if (!list)
return attr_list_new (start, len, attr);
if (!attr)
attr = &ZERO_ATTR;
old_len = list->len;
if (start >= old_len)
{
for (i = 0; i < start - old_len; ++i)
g_array_append_val (list, ZERO_ATTR);
for (i = 0; i < len; ++i)
g_array_append_val (list, *attr);
}
else
{
for (i = start; i < MIN (old_len, start + len); ++i)
g_array_index (list, MooTermTextAttr, i) = *attr;
if (start + len > old_len)
for (i = 0; i < start + len - old_len; ++i)
g_array_append_val (list, *attr);
}
return list;
}
/* deletes specified range and shifts back segments following deleted range */
inline static AttrList *attr_list_delete_range (AttrList *attrs,
gulong start,
gulong len)
{
if (!attrs || !len)
return attrs;
if (start > attrs->len)
return attrs;
if (start + len >= attrs->len)
{
if (!start)
{
g_array_free (attrs, TRUE);
return NULL;
}
else
{
return g_array_set_size (attrs, start);
}
}
return g_array_remove_range (attrs, start, len);
}
inline static AttrList *attr_list_insert_range (AttrList *list,
gulong pos,
gulong len,
gulong line_len,
MooTermTextAttr *attr)
{
guint i;
if (!len)
return list;
if (!list)
return attr_list_new (pos, len, attr);
if (pos >= list->len)
return attr_list_set_range (list, pos, len, attr);
if (!attr)
attr = &ZERO_ATTR;
for (i = 0; i < len; ++i)
g_array_insert_val (list, i, *attr);
if (list->len > line_len)
g_array_set_size (list, line_len);
return list;
}
static AttrList *attr_list_set_line_len (AttrList *attr,
gulong len)
{
if (!attr || !len || attr->len <= len)
return attr;
else
return g_array_set_size (attr, len);
}
typedef struct {
GByteArray *text;
AttrList *attrs;
} MooTermLine;
inline static MooTermLine *term_line_init (MooTermLine *line, gulong len)
{
line->text = g_byte_array_sized_new (len);
line->attrs = NULL;
return line;
}
inline static void term_line_destroy (MooTermLine *line)
inline static void term_line_free (MooTermLine *line)
{
if (line)
{
g_byte_array_free (line->text, TRUE);
attr_list_free (line->attrs);
}
g_array_free (TERM_LINE_ARRAY (line), TRUE);
}
inline static char *term_line_chars (MooTermLine *line)
inline static guint term_line_len (MooTermLine *line)
{
return (char*)line->text->data;
return line->len;
}
inline static char term_line_get_char (MooTermLine *line, gulong i)
inline static void term_line_set_len (MooTermLine *line, guint len)
{
if (i >= line->text->len)
return EMPTY_CHAR;
else
return line->text->data[i];
if (line->len > len)
g_array_set_size (TERM_LINE_ARRAY (line), len);
}
inline static gulong term_line_len (MooTermLine *line)
{
return line->text->len;
}
inline static void term_line_set_len (MooTermLine *line, gulong len)
inline static void term_line_erase (MooTermLine *line)
{
if (line->text->len > len)
g_byte_array_set_size (line->text, len);
line->attrs = attr_list_set_line_len (line->attrs, len);
}
inline static MooTermTextAttr *term_line_get_attr (MooTermLine *line, gulong i)
{
return attr_list_get_attr (line->attrs, i);
}
inline static void term_line_erase (MooTermLine *line)
{
g_byte_array_set_size (line->text, 0);
line->attrs = attr_list_free (line->attrs);
term_line_set_len (line, 0);
}
inline static void term_line_erase_range (MooTermLine *line,
gulong start,
gulong len,
MooTermTextAttr *attr)
guint pos,
guint len)
{
if (start >= line->text->len)
guint i;
if (!len)
return;
if (start + len > line->text->len)
len = line->text->len - start;
if (pos + len >= line->len)
return term_line_set_len (line, pos);
memset (line->text->data + start, EMPTY_CHAR, len);
line->attrs = attr_list_set_range (line->attrs, start, len, attr);
for (i = pos; i < pos + len; ++i)
{
line->data[pos].ch = EMPTY_CHAR;
line->data[pos].attr.mask = 0;
}
}
inline static void term_line_delete_range (MooTermLine *line,
gulong start,
gulong len)
guint pos,
guint len)
{
if (start >= line->text->len)
if (pos >= line->len)
return;
if (start + len > line->text->len)
len = line->text->len - start;
g_byte_array_remove_range (line->text, start, len);
line->attrs = attr_list_delete_range (line->attrs, start, len);
else if (pos + len >= line->len)
return term_line_set_len (line, pos);
else
g_array_remove_range (TERM_LINE_ARRAY (line), pos, len);
}
inline static void term_line_insert_chars (MooTermLine *line,
gulong pos,
char c,
gulong num,
gulong line_len,
MooTermTextAttr *attr)
inline static void term_line_set_unichar (MooTermLine *line,
guint pos,
gunichar c,
guint num,
MooTermTextAttr *attr,
guint width)
{
guint old_len = line->text->len;
guint i;
if (pos >= line_len)
return;
if (pos + num > line_len)
num = line_len - pos;
if (pos >= width)
return term_line_set_len (line, width);
if (pos >= old_len)
if (pos + num >= width)
num = width - pos;
if (!attr || !attr->mask)
attr = &ZERO_ATTR;
if (!c)
c = EMPTY_CHAR;
term_line_set_len (line, width);
if (pos >= line->len)
{
g_byte_array_set_size (line->text, pos + num);
memset (line->text->data + old_len, EMPTY_CHAR, pos - old_len);
memset (line->text->data + pos, c, num);
MooTermCell cell = {EMPTY_CHAR, ZERO_ATTR};
for (i = 0; i < pos - line->len; ++i)
g_array_append_val (TERM_LINE_ARRAY (line), cell);
cell.ch = c;
cell.attr = *attr;
for (i = 0; i < num; ++i)
g_array_append_val (TERM_LINE_ARRAY (line), cell);
}
else if (pos + num > line->len)
{
MooTermCell cell = {c, *attr};
for (i = pos; i < line->len; ++i)
g_array_index (TERM_LINE_ARRAY (line), MooTermCell, i) = cell;
for (i = 0; i < pos + num - line->len; ++i)
g_array_append_val (TERM_LINE_ARRAY (line), cell);
}
else
{
g_byte_array_set_size (line->text, old_len + num);
memmove (line->text->data + (pos + num),
line->text->data + pos,
old_len - pos);
memset (line->text->data + pos, c, num);
if (old_len + num > line_len)
g_byte_array_set_size (line->text, line_len);
MooTermCell cell = {c, *attr};
for (i = pos; i < pos + num; ++i)
g_array_index (TERM_LINE_ARRAY (line), MooTermCell, i) = cell;
}
line->attrs = attr_list_insert_range (line->attrs, pos,
num, line_len, attr);
}
inline static void term_line_insert_char (MooTermLine *line,
gulong pos,
char c,
MooTermTextAttr *attr,
gulong line_len)
inline static void term_line_insert_unichar (MooTermLine *line,
guint pos,
gunichar c,
guint num,
MooTermTextAttr *attr,
guint width)
{
term_line_insert_chars (line, pos, c, 1, line_len, attr);
}
guint i;
inline static void term_line_set_char (MooTermLine *line,
gulong pos,
char c,
MooTermTextAttr *attr,
gulong line_len)
{
if (pos >= line->text->len)
if (pos >= width)
return term_line_set_len (line, width);
if (pos + num >= width)
return term_line_set_unichar (line, pos, c, num,
attr, width);
if (!attr || !attr->mask)
attr = &ZERO_ATTR;
if (!c)
c = EMPTY_CHAR;
term_line_set_len (line, width);
for (i = 0; i < num; ++i)
{
term_line_insert_char (line, pos, c, attr, line_len);
}
else
{
line->text->data[pos] = c;
line->attrs = attr_list_set_range (line->attrs, pos, 1, attr);
MooTermCell cell = {c, *attr};
g_array_insert_val (TERM_LINE_ARRAY (line), pos, cell);
}
}
inline static char *term_line_get_text (MooTermLine *line)
inline static gunichar term_line_get_unichar (MooTermLine *line,
guint col)
{
return g_strndup ((char*)line->text->data, line->text->len);
return g_array_index (TERM_LINE_ARRAY (line), MooTermCell, col).ch;
}
inline static guint term_line_get_chars (MooTermLine *line,
char *buf,
guint first,
int len)
{
guint i;
guint res = 0;
if (!len || first >= line->len)
return 0;
if (len < 0 || first + len > line->len)
len = line->len - first;
for (i = first; i < first + len; ++i)
{
gunichar c = term_line_get_unichar (line, i);
guint l = g_unichar_to_utf8 (c, buf);
buf += l;
res += l;
}
return res;
}

View File

@ -18,6 +18,10 @@
#include <string.h>
#define INVALID_CHAR "?"
#define INVALID_CHAR_LEN 1
static void exec_command (MooTermParser *parser);
static void parser_init (MooTermParser *parser,
const char *string,
@ -142,6 +146,32 @@ inline static void chars_add_cmd (MooTermParser *parser)
parser->chars.end = parser->cmd_string.end;
}
inline static void _flush (MooTermBuffer *buf, const char *string, guint len)
{
const char *p = string;
const char *end = string + len;
const char *s;
g_assert (len != 0);
while (p != end)
{
for (s = p; s != end && *s && !(*s & 0x80); ++s) ;
if (s > p)
{
moo_term_buffer_print_chars (buf, p, s - p);
p = s;
}
else
{
if (*p++ & 0x80)
moo_term_buffer_print_chars (buf, INVALID_CHAR, INVALID_CHAR_LEN);
}
}
}
inline static void chars_flush (MooTermParser *parser)
{
if (!block_is_empty (&parser->chars))
@ -161,18 +191,18 @@ inline static void chars_flush (MooTermParser *parser)
{
g_assert (parser->chars.start.offset < parser->chars.end.offset);
moo_term_buffer_print_chars (parser->term_buffer,
parser->old_data + parser->chars.start.offset,
parser->chars.end.offset - parser->chars.start.offset);
_flush (parser->term_buffer,
parser->old_data + parser->chars.start.offset,
parser->chars.end.offset - parser->chars.start.offset);
}
else
{
moo_term_buffer_print_chars (parser->term_buffer,
parser->old_data + parser->chars.start.offset,
parser->old_data_len - parser->chars.start.offset);
moo_term_buffer_print_chars (parser->term_buffer,
parser->data,
parser->chars.end.offset);
_flush (parser->term_buffer,
parser->old_data + parser->chars.start.offset,
parser->old_data_len - parser->chars.start.offset);
_flush (parser->term_buffer,
parser->data,
parser->chars.end.offset);
}
}
else
@ -180,9 +210,9 @@ inline static void chars_flush (MooTermParser *parser)
g_assert (!parser->chars.end.old);
g_assert (parser->chars.start.offset < parser->chars.end.offset);
moo_term_buffer_print_chars (parser->term_buffer,
parser->data + parser->chars.start.offset,
parser->chars.end.offset - parser->chars.start.offset);
_flush (parser->term_buffer,
parser->data + parser->chars.start.offset,
parser->chars.end.offset - parser->chars.start.offset);
}
block_set_empty (&parser->chars);
@ -572,7 +602,7 @@ static void exec_decset (MooTermBuffer *buf,
buf->priv->modes |= MOUSE_TRACKING;
g_object_notify (G_OBJECT (buf), "mode-MOUSE-TRACKING");
break;
case 1001:
buf->priv->modes |= HILITE_MOUSE_TRACKING;
g_object_notify (G_OBJECT (buf), "mode-HILITE-MOUSE-TRACKING");
@ -634,12 +664,12 @@ static void exec_decrst (MooTermBuffer *buf,
case 1049:
break;
case 1000:
buf->priv->modes &= ~MOUSE_TRACKING;
g_object_notify (G_OBJECT (buf), "mode-MOUSE-TRACKING");
break;
case 1001:
buf->priv->modes &= ~HILITE_MOUSE_TRACKING;
g_object_notify (G_OBJECT (buf), "mode-HILITE-MOUSE-TRACKING");
@ -932,7 +962,7 @@ static void exec_restore_decset (MooTermBuffer *buf,
buf->priv->modes &= ~MOUSE_TRACKING;
g_object_notify (G_OBJECT (buf), "mode-MOUSE_TRACKING");
break;
case 1001:
if (buf->priv->saved_modes & HILITE_MOUSE_TRACKING)
buf->priv->modes |= HILITE_MOUSE_TRACKING;
@ -956,7 +986,7 @@ static void exec_save_decset (MooTermBuffer *buf,
if (!num_params)
{
g_warning ("%s: ???", G_STRLOC);
buf->priv->saved_modes = buf->priv->modes & DEC_MODES;
buf->priv->saved_modes = buf->priv->modes;
return;
}
@ -1009,7 +1039,7 @@ static void exec_save_decset (MooTermBuffer *buf,
else
buf->priv->saved_modes &= ~MOUSE_TRACKING;
break;
case 1001:
if (buf->priv->modes & HILITE_MOUSE_TRACKING)
buf->priv->saved_modes |= HILITE_MOUSE_TRACKING;

View File

@ -75,8 +75,8 @@ struct _MooTermVtUnixClass {
static void moo_term_vt_unix_finalize (GObject *object);
static void set_size (MooTermVt *vt,
gulong width,
gulong height);
guint width,
guint height);
static gboolean fork_command (MooTermVt *vt,
const char *cmd,
const char *working_dir,
@ -91,7 +91,7 @@ static gboolean read_child_out (GIOChannel *source,
MooTermVtUnix *vt);
static void feed_buffer (MooTermVtUnix *vt,
const char *string,
gssize len);
int len);
static void start_writer (MooTermVt *vt);
static void stop_writer (MooTermVt *vt);
@ -139,8 +139,8 @@ static void moo_term_vt_unix_finalize (GObject *object)
static void set_size (MooTermVt *vt,
gulong width,
gulong height)
guint width,
guint height)
{
MooTermVtUnix *vtu;
@ -452,7 +452,7 @@ error:
static void feed_buffer (MooTermVtUnix *vt,
const char *string,
gssize len)
int len)
{
moo_term_buffer_write (moo_term_vt_get_buffer (MOO_TERM_VT (vt)),
string, len);
@ -464,10 +464,10 @@ static void feed_buffer (MooTermVtUnix *vt,
to string, length of it to len, and fills err in case of error */
static gboolean do_write (MooTermVt *vt_gen,
const char **string,
gsize *plen,
guint *plen,
int *err)
{
gssize written;
int written;
MooTermVtUnix *vt = MOO_TERM_VT_UNIX (vt_gen);
@ -540,7 +540,7 @@ static void stop_writer (MooTermVt *vt)
static void vt_write (MooTermVt *vt,
const char *data,
gssize data_len)
int data_len)
{
g_return_if_fail (data == NULL || data_len != 0);
@ -548,7 +548,7 @@ static void vt_write (MooTermVt *vt,
{
int err = 0;
const char *string;
gsize len;
guint len;
GByteArray *freeme = NULL;
if (!g_queue_is_empty (vt->priv->pending_write))
@ -566,7 +566,7 @@ static void vt_write (MooTermVt *vt,
else
{
string = data;
len = data_len > 0 ? (gsize)data_len : strlen (data);
len = data_len > 0 ? (guint)data_len : strlen (data);
data = NULL;
}

View File

@ -171,8 +171,8 @@ MooTermVt *moo_term_vt_new (void)
void moo_term_vt_set_size (MooTermVt *vt,
gulong width,
gulong height)
guint width,
guint height)
{
g_return_if_fail (MOO_IS_TERM_VT (vt));
MOO_TERM_VT_GET_CLASS(vt)->set_size (vt, width, height);

View File

@ -44,8 +44,8 @@ struct _MooTermVtClass {
/* virtual methods */
void (*set_size) (MooTermVt *vt,
gulong width,
gulong height);
guint width,
guint height);
gboolean (*fork_command) (MooTermVt *vt,
const char *cmd,
const char *working_dir,
@ -72,8 +72,8 @@ void moo_term_vt_set_buffer (MooTermVt *vt,
MooTermBuffer *moo_term_vt_get_buffer (MooTermVt *vt);
void moo_term_vt_set_size (MooTermVt *vt,
gulong width,
gulong height);
guint width,
guint height);
gboolean moo_term_vt_fork_command (MooTermVt *vt,
const char *cmd,

View File

@ -9,8 +9,8 @@ STRING:VOID
VOID:BOOL
VOID:INT
VOID:STRING
VOID:ULONG
VOID:ULONG,ULONG
VOID:UINT
VOID:UINT,UINT
VOID:VOID
VOID:OBJECT
VOID:OBJECT,OBJECT

View File

@ -3,26 +3,44 @@
<general>
<author>Yevgen Muntyan</author>
<email>muntyan@math.tamu.edu</email>
<version>0.5.92</version>
<version>$VERSION$</version>
<projectmanagement>KDevAutoProject</projectmanagement>
<primarylanguage>C++</primarylanguage>
<ignoreparts/>
<ignoreparts>
<part>kdevabbrev</part>
<part>kdevclassview</part>
<part>kdevsnippet</part>
<part>kdevctags2</part>
<part>kdevdocumentation</part>
<part>kdevdoxygen</part>
<part>kdevfilegroups</part>
<part>kdevfilelist</part>
<part>kdevfileview</part>
<part>kdevdistpart</part>
<part>kdevopenwith</part>
<part>kdevpartexplorer</part>
<part>kdevregexptest</part>
<part>kdevrbdebugger</part>
<part>kdevscripting</part>
<part>kdevtexttools</part>
<part>kdevvisualboyadvance</part>
</ignoreparts>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description/>
<secondaryLanguages>
<language>C</language>
</secondaryLanguages>
<versioncontrol/>
<versioncontrol>kdevsubversion</versioncontrol>
</general>
<kdevautoproject>
<general>
<activetarget>src/mooedit/libmooedit.la</activetarget>
<useconfiguration>medit</useconfiguration>
<activetarget>moo/mooedit/libmooedit.la</activetarget>
<useconfiguration>debug-mooedit</useconfiguration>
</general>
<run>
<mainprogram>tests/editor</mainprogram>
<directoryradio>build</directoryradio>
<directoryradio>executable</directoryradio>
<customdirectory>/</customdirectory>
<programargs/>
<terminal>false</terminal>
@ -31,8 +49,8 @@
</run>
<configurations>
<debug>
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --disable-moo-module</configargs>
<builddir>build/debug</builddir>
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooterm --without-mooapp --without-python</configargs>
<builddir>build/debug-mooedit</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
@ -48,8 +66,8 @@
<f77flags/>
</debug>
<optimized>
<configargs>--enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooterm --without-mooui</configargs>
<builddir>build/optimized</builddir>
<configargs>--enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooterm --without-mooapp --without-python</configargs>
<builddir>build/optimized-mooedit</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
@ -88,8 +106,8 @@
<envvar value="/usr/bin/i586-mingw32msvc-strip" name="STRIP" />
<envvar value="/usr/bin/i586-mingw32msvc-windres" name="WINDRES" />
</envvars>
<configargs>--target=i586-mingw32msvc --host=i586-mingw32msvc --enable-all-gcc-warnings=fatal --without-mooterm --without-mooui</configargs>
<builddir>build/mingw</builddir>
<configargs>--target=i586-mingw32msvc --host=i586-mingw32msvc --enable-all-gcc-warnings=fatal --without-mooterm --without-mooapp --without-python</configargs>
<builddir>build/mingw-mooedit</builddir>
<topsourcedir/>
<cppflags/>
<ldflags/>
@ -103,83 +121,10 @@
<cxxflags>-O3 -g0 -march=i686 -mms-bitfields</cxxflags>
<f77flags/>
</mingw>
<cygwin>
<envvars>
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-ar" name="AR" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-gcc" name="CC" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-cpp" name="CPP" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-g++" name="CXX" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-dlltool" name="DLLTOOL" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-dllwrap" name="DLLWRAP" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-gcov" name="GCOV" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-ld" name="LD" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-nm" name="NM" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-objcopy" name="OBJCOPY" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-objdump" name="OBJDUMP" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-ranlib" name="RANLIB" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-readelf" name="READELF" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-size" name="SIZE" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-strings" name="STRINGS" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-strip" name="STRIP" />
<envvar value="/usr/lib/cygwin/bin//i686-pc-cygwin-windres" name="WINDRES" />
</envvars>
<configargs>--enable-all-gcc-warnings=fatal</configargs>
<builddir>build/cygwin</builddir>
<topsourcedir/>
<cppflags/>
<ldflags/>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<ccompilerbinary>i686-pc-cygwin-gcc</ccompilerbinary>
<cxxcompilerbinary>i686-pc-cygwin-g++</cxxcompilerbinary>
<f77compilerbinary/>
<cflags>-O3 -g0 -march=i686 -mms-bitfields</cflags>
<cxxflags>-O3 -g0 -march=i686 -mms-bitfields</cxxflags>
<f77flags/>
</cygwin>
<medit>
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooterm --without-mooapp</configargs>
<builddir>build/medit</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<cflags>-O0 -g3 -pg</cflags>
<cxxflags>-O0 -g3 -pg</cxxflags>
<envvars/>
<topsourcedir/>
<cppflags/>
<ldflags/>
<ccompilerbinary/>
<cxxcompilerbinary/>
<f77compilerbinary/>
<f77flags/>
</medit>
<gcc-4>
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --without-mooterm --without-mooui --without-native-gtksourceview</configargs>
<builddir>build/gcc-4</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<cflags>-O0 -g3 -pg</cflags>
<cxxflags>-O0 -g3 -pg</cxxflags>
<envvars>
<envvar value="gcc-4.0" name="CC" />
<envvar value="g++-4.0" name="CXX" />
<envvar value="cpp-4.0" name="CPP" />
</envvars>
<topsourcedir/>
<cppflags/>
<ldflags/>
<ccompilerbinary>gcc-4.0</ccompilerbinary>
<cxxcompilerbinary>g++-4.0</cxxcompilerbinary>
<f77compilerbinary/>
<f77flags/>
</gcc-4>
<gtk-2.2>
<envvars/>
<configargs>--enable-debug --enable-all-gcc-warnings=fatal --with-path=/usr/local/lib/gtk-2.2/bin:$PATH --with-pkg-config-path=/usr/local/lib/gtk-2.2/lib/pkgconfig:$PKG_CONFIG_PATH --without-mooterm --without-mooui</configargs>
<builddir>build/gtk-2.2</builddir>
<configargs>--enable-debug --enable-all-gcc-warnings=fatal --with-path=/usr/local/lib/gtk-2.2:$PATH --with-pkg-config-path=/usr/local/lib/gtk-2.2/lib/pkgconfig:$PKG_CONFIG_PATH --without-mooterm --without-mooapp --without-python</configargs>
<builddir>build/gtk-2.2-mooedit</builddir>
<topsourcedir/>
<cppflags/>
<ldflags/>
@ -206,7 +151,7 @@
<kdevdebugger>
<general>
<dbgshell>libtool</dbgshell>
<programargs>--g-fatal-warnings</programargs>
<programargs>--g-fatal-warnings bash</programargs>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
@ -275,9 +220,6 @@
</kdevdoctreeview>
<kdevfilecreate>
<filetypes>
<type icon="source_py" ext="py" create="template" name="Python" >
<descr>A new empty Python source file.</descr>
</type>
<type icon="source" ext="g" create="template" name="GAP source" >
<descr>A new empty GAP source file</descr>
</type>
@ -337,7 +279,7 @@
<tree>
<showvcsfields>false</showvcsfields>
<hidenonprojectfiles>true</hidenonprojectfiles>
<hidepatterns>*</hidepatterns>
<hidepatterns/>
</tree>
</kdevfileview>
<kdevcvsservice>
@ -349,15 +291,6 @@
</kdevcvsservice>
<ctagspart>
<customArguments/>
<customTagfilePath>/home/muntyan/projects/moo/moo.tags</customTagfilePath>
<customTagfilePath/>
</ctagspart>
<kdevvisualadvance>
<emulator>VisualBoyAdvance</emulator>
<binary/>
<addOptions/>
<terminal>false</terminal>
<fullscreen>false</fullscreen>
<graphicFilter>-f0</graphicFilter>
<scaling>-1</scaling>
</kdevvisualadvance>
</kdevelop>

View File

@ -27,7 +27,7 @@
</ignoreparts>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description></description>
<description/>
<secondaryLanguages>
<language>C</language>
</secondaryLanguages>
@ -152,10 +152,10 @@
<general>
<dbgshell>libtool</dbgshell>
<programargs>--g-fatal-warnings bash</programargs>
<gdbpath></gdbpath>
<configGdbScript></configGdbScript>
<runShellScript></runShellScript>
<runGdbScript></runGdbScript>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>true</floatingtoolbar>
@ -220,16 +220,16 @@
</kdevdoctreeview>
<kdevfilecreate>
<filetypes>
<type icon="source" ext="g" create="template" name="GAP source" >
<type icon="source" ext="g" name="GAP source" create="template" >
<descr>A new empty GAP source file</descr>
</type>
<type icon="source_cpp" ext="cpp" create="template" name="C++ Source" >
<type icon="source_cpp" ext="cpp" name="C++ Source" create="template" >
<descr>A new empty C++ file.</descr>
</type>
<type icon="source_h" ext="h" create="template" name="C/C++ Header" >
<type icon="source_h" ext="h" name="C/C++ Header" create="template" >
<descr>A new empty header file for C/C++.</descr>
</type>
<type icon="source_c" ext="c" create="template" name="C Source" >
<type icon="source_c" ext="c" name="C Source" create="template" >
<descr>A new empty C file.</descr>
</type>
</filetypes>
@ -256,7 +256,7 @@
</codecompletion>
<references/>
<creategettersetter>
<prefixGet></prefixGet>
<prefixGet/>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>

View File

@ -68,7 +68,7 @@ G_GNUC_UNUSED static gboolean print_random_hard (MooTerm *term)
moo_term_force_update (term);
}
g_print ("buffer: %ldx%ld\nterm: %ldx%ld\n",
g_print ("buffer: %dx%d\nterm: %dx%d\n",
buf_total_height (buf), buf_screen_width (buf),
term_height (term), term_width (term));