]> granicus.if.org Git - neomutt/commitdiff
[patch-0.94.4i.gt.arrowcursor.1] Padding to the end of
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 27 Aug 1998 19:37:10 +0000 (19:37 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 27 Aug 1998 19:37:10 +0000 (19:37 +0000)
line/right jusitifying does not work in menus when
$arrow_cursor is set, because the extra space needed for
the arrow is not taken into account.
(From Gero Treuner <gero@faveve.uni-stuttgart.de>)

addrbook.c
browser.c
curs_main.c
lib.c
mutt.h
postpone.c
recvattach.c

index 9334796b55b7a1bed39d5163087b167f1d6fb743..f589079a46fff80916c06e865bf82ca369824e57 100644 (file)
@@ -80,7 +80,7 @@ int alias_search (MUTTMENU *m, regex_t *re, int n)
 
 void alias_entry (char *s, size_t slen, MUTTMENU *m, int num)
 {
-  mutt_FormatString (s, slen, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], 0);
+  mutt_FormatString (s, slen, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], M_FORMAT_ARROWCURSOR);
 }
 
 int alias_tag (MUTTMENU *menu, int n)
index a90d517355baf714a64f0c97e1b2fd79995ae47d..d1d67d3dd7a04425a05b1c55332f85d1f2e7fbb7 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -295,8 +295,9 @@ static void add_folder (MUTTMENU *m, struct browser_state *state,
   folder.name = name;
   folder.f = s;
   folder.new = new;
-  mutt_FormatString (buffer, sizeof (buffer), NONULL(FolderFormat), folder_format_str,
-                    (unsigned long) &folder, 0);
+  mutt_FormatString (buffer, sizeof (buffer), NONULL(FolderFormat),
+                    folder_format_str, (unsigned long) &folder,
+                    M_FORMAT_ARROWCURSOR);
 
   if (state->entrylen == state->entrymax)
   {
index d1be5a8bf0fcb7b0366e7a82212fc07c28936a9c..401a18b711cfecf022b655807a2d0c28e5a28c1d 100644 (file)
@@ -74,7 +74,7 @@ extern const char *ReleaseDate;
 
 void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num)
 {
-  format_flag flag = M_FORMAT_MAKEPRINT;
+  format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR;
   int reverse = Sort & SORT_REVERSE, edgemsgno;
   HEADER *tmp, *h = Context->hdrs[Context->v2r[num]];
 
diff --git a/lib.c b/lib.c
index c5bb3e39213c0f0945b0f7b9bdbebe096fadebb0..45d901d35f81590fa4b01f69c255a729762b1176 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -885,9 +885,11 @@ void mutt_FormatString (char *dest,                /* output buffer */
 {
   char prefix[SHORT_STRING], buf[LONG_STRING], *cp, *wptr = dest, ch;
   char ifstring[SHORT_STRING], elsestring[SHORT_STRING];
-  size_t wlen = 0, count, len;
+  size_t wlen, count, len;
 
   destlen--; /* save room for the terminal \0 */
+  wlen = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0;
+    
   while (*src && wlen < destlen)
   {
     if (*src == '%')
diff --git a/mutt.h b/mutt.h
index 2b7bc5f6939c1e2d87671fecf3421b4e843d6cc5..d68f60ad072a99e023a4630c7480aa7868388636 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -99,7 +99,8 @@ typedef enum
   M_FORMAT_TREE                = (1<<1), /* draw the thread tree */
   M_FORMAT_MAKEPRINT   = (1<<2), /* make sure that all chars are printable */
   M_FORMAT_OPTIONAL    = (1<<3),
-  M_FORMAT_STAT_FILE   = (1<<4)  /* used by mutt_attach_fmt */
+  M_FORMAT_STAT_FILE   = (1<<4), /* used by mutt_attach_fmt */
+  M_FORMAT_ARROWCURSOR = (1<<5)  /* reserve space for arrow_cursor */
 } format_flag;
 
 /* types for mutt_add_hook() */
index 0ef74fbe8fe9bb5a0de8df46300434491f4f9630..5062507e1b78413a747803742a5464397be40662 100644 (file)
@@ -94,7 +94,8 @@ static void post_entry (char *s, size_t slen, MUTTMENU *menu, int entry)
 {
   CONTEXT *ctx = (CONTEXT *) menu->data;
 
-  mutt_make_string (s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry]);
+  _mutt_make_string (s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry],
+                    M_FORMAT_ARROWCURSOR);
 }
 
 static HEADER *select_msg (void)
index cd16309d0db4bf7eba18fa3754946bc7a7c8ec68..585fb56ab51940e3db61bdc2326021aa3aee8ee2 100644 (file)
@@ -170,7 +170,7 @@ const char *mutt_attach_fmt (char *dest,
       {
        char s[SHORT_STRING];
        _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr,
-           M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT);
+           M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR);
        if (*s)
        {
          snprintf (dest, destlen, fmt, s);
@@ -243,7 +243,7 @@ const char *mutt_attach_fmt (char *dest,
 
 void attach_entry (char *b, size_t blen, MUTTMENU *menu, int num)
 {
-  mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **)menu->data)[num]), 0);
+  mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **)menu->data)[num]), M_FORMAT_ARROWCURSOR);
 }
 
 int mutt_tag_attach (MUTTMENU *menu, int n)