Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49590 - in /trunk/gtk: ChangeLog src/YGUtils.cc src/ygtkrichtext.c
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Sat, 02 Aug 2008 02:07:21 -0000
  • Message-id: <20080802020721.C29102735E@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Sat Aug 2 04:07:20 2008
New Revision: 49590

URL: http://svn.opensuse.org/viewcvs/yast?rev=49590&view=rev
Log:
* src/YGUtils.cc & src/ygtkrichtext.c: fixed some glitches left from
bug 396692, and fixed bug 404817 glitch.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/ygtkrichtext.c

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=49590&r1=49589&r2=49590&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Sat Aug 2 04:07:20 2008
@@ -1,3 +1,8 @@
+2008-08-02 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>
+
+ * src/YGUtils.cc & src/ygtkrichtext.c: fixed some glitches left from
+ bug 396692, and fixed bug 404817 glitch.
+
2008-07-31 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

* src/YGPackageSelector.cc: online update was broken.

Modified: trunk/gtk/src/YGUtils.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=49590&r1=49589&r2=49590&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Sat Aug 2 04:07:20 2008
@@ -262,6 +262,7 @@
GQueue *tag_queue = g_queue_new();
int i = 0;

+ gboolean was_space = TRUE;
skipSpace (instr, i);

// we must add an outer tag to make GMarkup happy
@@ -311,10 +312,10 @@
}

// Unmatched tags
- if ( !is_close && tag_len == 2 &&
- (!g_ascii_strncasecmp (tag->str, "hr", 2) ||
+ if (!is_close && tag_len == 2 &&
+ (!g_ascii_strncasecmp (tag->str, "hr", 2) ||
!g_ascii_strncasecmp (tag->str, "br", 2)) &&
- tag->str[tag->len - 1] != '/')
+ tag->str[tag->len - 1] != '/')
g_string_append_c (tag, '/');

// Add quoting for un-quoted attributes
@@ -369,10 +370,20 @@
// Replace this by a white-space
g_string_append (outp, " ");
i += sizeof ("&nbsp;") - 2;
+ was_space = FALSE;
}

- else // Normal text
- g_string_append_c (outp, instr[i]);
+ else { // Normal text
+ if (g_ascii_isspace (instr[i])) {
+ if (!was_space)
+ g_string_append_c (outp, ' ');
+ was_space = TRUE;
+ }
+ else {
+ was_space = FALSE;
+ g_string_append_c (outp, instr[i]);
+ }
+ }
}

emit_unclosed_tags_for (outp, tag_queue, "", 0);

Modified: trunk/gtk/src/ygtkrichtext.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=49590&r1=49589&r2=49590&view=diff
==============================================================================
--- trunk/gtk/src/ygtkrichtext.c (original)
+++ trunk/gtk/src/ygtkrichtext.c Sat Aug 2 04:07:20 2008
@@ -274,8 +274,6 @@
free_list (state->htags);
}

-static gchar *elide_whitespace (const gchar *instr, gint len);
-
// Tags to support: <p> and not </p>:
// either 'elide' \ns (turn off with <pre> I guess
static void
@@ -301,7 +299,9 @@
// Check if this is a block tag
if (isBlockTag (element_name)) {
// make sure this opens a new paragraph
- if (!gtk_text_iter_starts_line (&iter)) {
+ if (state->html_list && gtk_text_iter_get_line_offset (&iter) <
6)
+ ; // on a list, there is the "1. " in the buffer so we
have to do this
+ else if (!gtk_text_iter_starts_line (&iter)) {
gtk_text_buffer_insert (state->buffer, &iter, "\n", -1);
gtk_text_buffer_get_end_iter (state->buffer, &iter);
}
@@ -447,6 +447,8 @@

if (isBlockTag (element_name) || !g_ascii_strcasecmp (element_name,
"br")) {
appendLines = 1;
+ if (isBlockTag (element_name) && gtk_text_iter_starts_line
(&end))
+ appendLines = 0;
state->closed_block_tag = TRUE;
}
else
@@ -480,15 +482,13 @@
gtk_text_buffer_insert_with_tags (state->buffer, &start,
text, text_len, NULL, NULL);
else {
- if (!state->closed_block_tag) {
- if (g_ascii_isspace (text[0]))
- gtk_text_buffer_insert (state->buffer, &start,
" ", 1);
+ int i = 0;
+ if (state->closed_block_tag) {
+ for (; i < text_len; i++)
+ if (!g_ascii_isspace (text[i]))
+ break;
}
- state->closed_block_tag = FALSE;
-
- gchar *real = elide_whitespace (text, text_len);
- gtk_text_buffer_insert (state->buffer, &start, real, -1);
- g_free (real);
+ gtk_text_buffer_insert (state->buffer, &start, text+i,
text_len-i);
}
gtk_text_buffer_get_end_iter (state->buffer, &end);
}
@@ -523,31 +523,6 @@
return g_object_new (YGTK_TYPE_RICH_TEXT, NULL);
}

-/* String preparation methods. */
-static gchar *elide_whitespace (const gchar *instr, gint len)
-{
- GString *dest = g_string_new ("");
- if (len < 0)
- len = strlen (instr);
- // collapse more than one space in one
- gboolean start_text = TRUE, is_white = FALSE;
- gint i;
- for (i = 0; i < len; i++) {
- gchar ch = instr[i];
- if (g_ascii_isspace (ch)) {
- if (!is_white && !start_text)
- g_string_append_c (dest, ' ');
- is_white = TRUE;
- }
- else {
- g_string_append_c (dest, ch);
- is_white = FALSE;
- start_text = FALSE;
- }
- }
- return g_string_free (dest, FALSE);
-}
-
void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text, gboolean
plain_mode)
{
GtkTextBuffer *buffer;

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages