packages feed

isocline 1.0.6 → 1.0.7

raw patch · 4 files changed

+39/−40 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

isocline.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           isocline-version:        1.0.6+version:        1.0.7 synopsis:       A portable alternative to GNU Readline description:    ![logo](https://raw.githubusercontent.com/daanx/isocline/main/doc/isocline-inline.svg) A Haskell wrapper around the [Isocline C library](https://github.com/daanx/isocline#readme) which can provide an alternative to GNU Readline. (The Isocline library is included whole and there are no runtime dependencies).                 Please see the [readme](https://github.com/daanx/isocline/haskell#readme) on GitHub for more information.
src/history.c view
@@ -189,10 +189,10 @@     if (c == EOF || c == '\n') break;     if (c == '\\') {       c = fgetc(f);-      if (c == 'n')       sbuf_append(sbuf,"\n");-      else if (c == 'r')  sbuf_append(sbuf,"\r");-      else if (c == 't')  sbuf_append(sbuf,"\t");-      else if (c == '\\') sbuf_append(sbuf,"\\");+      if (c == 'n')       { sbuf_append(sbuf,"\n"); }+      else if (c == 'r')  { /* ignore */ }  // sbuf_append(sbuf,"\r");+      else if (c == 't')  { sbuf_append(sbuf,"\t"); }+      else if (c == '\\') { sbuf_append(sbuf,"\\"); }       else if (c == 'x') {         int c1 = fgetc(f);                  int c2 = fgetc(f);@@ -217,7 +217,7 @@     char c = *entry++;     if (c == '\\')      { sbuf_append(sbuf,"\\\\"); }     else if (c == '\n') { sbuf_append(sbuf,"\\n"); }-    else if (c == '\r') { sbuf_append(sbuf,"\\r"); }+    else if (c == '\r') { /* ignore */ } // sbuf_append(sbuf,"\\r"); }     else if (c == '\t') { sbuf_append(sbuf,"\\t"); }     else if (c < ' ' || c > '~' || c == '#') {       char c1 = to_xdigit( (uint8_t)c / 16 );
src/isocline.c view
@@ -10,7 +10,7 @@ // symbols are public in the libray. //  // You can compile the entire library just as: -// $ gcc -c src/isocline.c+// $ gcc -c src/isocline.c  //------------------------------------------------------------- #if !defined(IC_SEPARATE_OBJS) # define _CRT_SECURE_NO_WARNINGS  // for msvc
src/term.c view
@@ -348,43 +348,42 @@   if (getenv("NO_COLOR") != NULL) {     term->nocolor = true;   }-  if (!term->nocolor) {-    // detect color palette-    // COLORTERM takes precedence-    const char* colorterm = getenv("COLORTERM");  -    const char* eterm = getenv("TERM");    -    if (ic_contains(colorterm,"24bit") || ic_contains(colorterm,"truecolor") || ic_contains(colorterm,"direct")) { -      term->palette = ANSIRGB; ++  // detect color palette+  // COLORTERM takes precedence+  const char* colorterm = getenv("COLORTERM");  +  const char* eterm = getenv("TERM");    +  if (ic_contains(colorterm,"24bit") || ic_contains(colorterm,"truecolor") || ic_contains(colorterm,"direct")) { +    term->palette = ANSIRGB; +  }+  else if (ic_contains(colorterm,"8bit") || ic_contains(colorterm,"256color")) { term->palette = ANSI256; } +  else if (ic_contains(colorterm,"4bit") || ic_contains(colorterm,"16color"))  { term->palette = ANSI16; }+  else if (ic_contains(colorterm,"3bit") || ic_contains(colorterm,"8color"))   { term->palette = ANSI8; }+  else if (ic_contains(colorterm,"1bit") || ic_contains(colorterm,"nocolor") || ic_contains(colorterm,"monochrome")) { +    term->palette = MONOCHROME; +  }+  // otherwise check for some specific terminals+  else if (getenv("WT_SESSION") != NULL) { term->palette = ANSIRGB; } // Windows terminal+  else if (getenv("ITERM_SESSION_ID") != NULL) { term->palette = ANSIRGB; } // iTerm2 terminal+  else if (getenv("VSCODE_PID") != NULL) { term->palette = ANSIRGB; } // vscode terminal+  else {+    // and otherwise fall back to checking TERM+    if (ic_contains(eterm,"truecolor") || ic_contains(eterm,"direct") || ic_contains(colorterm,"24bit")) {+      term->palette = ANSIRGB;     }-    else if (ic_contains(colorterm,"8bit") || ic_contains(colorterm,"256color")) { term->palette = ANSI256; } -    else if (ic_contains(colorterm,"4bit") || ic_contains(colorterm,"16color"))  { term->palette = ANSI16; }-    else if (ic_contains(colorterm,"3bit") || ic_contains(colorterm,"8color"))   { term->palette = ANSI8; }-    else if (ic_contains(colorterm,"1bit") || ic_contains(colorterm,"nocolor") || ic_contains(colorterm,"monochrome")) { -      term->palette = MONOCHROME; +    else if (ic_contains(eterm,"alacritty") || ic_contains(eterm,"kitty")) {+      term->palette = ANSIRGB;     }-    // otherwise check for some specific terminals-    else if (getenv("WT_SESSION") != NULL) { term->palette = ANSIRGB; } // Windows terminal-    else if (getenv("ITERM_SESSION_ID") != NULL) { term->palette = ANSIRGB; } // iTerm2 terminal-    else if (getenv("VSCODE_PID") != NULL) { term->palette = ANSIRGB; } // vscode terminal-    else {-      // and otherwise fall back to checking TERM-      if (ic_contains(eterm,"truecolor") || ic_contains(eterm,"direct") || ic_contains(colorterm,"24bit")) {-        term->palette = ANSIRGB;-      }-      else if (ic_contains(eterm,"alacritty") || ic_contains(eterm,"kitty")) {-        term->palette = ANSIRGB;-      }-      else if (ic_contains(eterm,"256color") || ic_contains(eterm,"gnome")) { -        term->palette = ANSI256;-      }  -      else if (ic_contains(eterm,"16color")){ term->palette = ANSI16; }-      else if (ic_contains(eterm,"8color")) { term->palette = ANSI8; }-      else if (ic_contains(eterm,"monochrome") || ic_contains(eterm,"nocolor") || ic_contains(eterm,"dumb")) { -        term->palette = MONOCHROME; -      }+    else if (ic_contains(eterm,"256color") || ic_contains(eterm,"gnome")) { +      term->palette = ANSI256;+    }  +    else if (ic_contains(eterm,"16color")){ term->palette = ANSI16; }+    else if (ic_contains(eterm,"8color")) { term->palette = ANSI8; }+    else if (ic_contains(eterm,"monochrome") || ic_contains(eterm,"nocolor") || ic_contains(eterm,"dumb")) { +      term->palette = MONOCHROME;      }-    debug_msg("term: color-bits: %d (COLORTERM=%s, TERM=%s)\n", term_get_color_bits(term), colorterm, eterm);   }+  debug_msg("term: color-bits: %d (COLORTERM=%s, TERM=%s)\n", term_get_color_bits(term), colorterm, eterm);      // read COLUMS/LINES from the environment for a better initial guess.   const char* env_columns = getenv("COLUMNS");