Beispiel #1
0
/*
 * Ring the bell if ring-bell is set.
 */
void
ding (void)
{
  if (thisflag & FLAG_DEFINING_MACRO)
    cancel_kbd_macro ();

  if (get_variable_bool ("ring-bell"))
    term_beep ();
}
Beispiel #2
0
static int
calculate_highlight_region (Window wp, Region *rp)
{
  if ((wp != cur_wp
       && !get_variable_bool ("highlight-nonselected-windows"))
      || get_buffer_mark (get_window_bp (wp)) == NULL
      || !get_buffer_mark_active (get_window_bp (wp)))
    return false;

  *rp = region_new (window_o (wp), get_marker_o (get_buffer_mark (get_window_bp (wp))));
  return true;
}
Beispiel #3
0
Datei: line.c Projekt: M1lan/zile
static bool
insert_tab (void)
{
  if (warn_if_readonly_buffer ())
    return false;

  if (get_variable_bool ("indent-tabs-mode"))
    insert_char ('\t');
  else
    insert_expanded_tab ();

  return true;
}
Beispiel #4
0
static bool
search (Point pt, const char *s, int forward, int regexp)
{
  Line *lp = pt.p;
  astr as = get_line_text (lp);
  size_t ssize = strlen (s), from = 0, to = astr_len (as);
  bool downcase = get_variable_bool ("case-fold-search") && no_upper (s, ssize, regexp);
  bool notbol = false, noteol = false;
  int pos;

  if (ssize < 1)
    return false;

  /* Match first line. */
  if (forward)
    {
      notbol = pt.o > from;
      from = pt.o;
    }
  else
    {
      noteol = pt.o < to;
      to = pt.o;
    }
  pos = find_substr (as, s, ssize, from, to, forward, notbol, noteol, regexp, downcase);

  /* Match following lines. */
  while (pos < 0)
    {
      lp = (forward ? get_line_next : get_line_prev) (lp);
      if (lp == get_buffer_lines (cur_bp))
        break;
      as = get_line_text (lp);
      pos = find_substr (as, s, ssize, 0, astr_len (as), forward, false, false, regexp, downcase);
    }

  if (pos < 0)
    return false;

  while (get_buffer_pt (cur_bp).p != lp)
    (forward ? next_line : previous_line) ();
  pt = get_buffer_pt (cur_bp);
  pt.o = pos;
  set_buffer_pt (cur_bp, pt);
  thisflag |= FLAG_NEED_RESYNC;
  return true;
}