Beispiel #1
0
static const char *
make_mode_line_flags (Window wp)
{
  if (get_buffer_modified (get_window_bp (wp)) && get_buffer_readonly (get_window_bp (wp)))
    return "%*";
  else if (get_buffer_modified (get_window_bp (wp)))
    return "**";
  else if (get_buffer_readonly (get_window_bp (wp)))
    return "%%";
  return "--";
}
Beispiel #2
0
/*
 * Save a reverse delta for doing undo.
 */
void
undo_save (int type, Point pt, size_t osize, size_t size)
{
  Undo *up;

  if (get_buffer_noundo (cur_bp) || undo_nosave)
    return;

  up = (Undo *) XZALLOC (Undo);
  up->type = type;
  up->n = pt.n;
  up->o = pt.o;
  if (!get_buffer_modified (cur_bp))
    up->unchanged = true;

  if (type == UNDO_REPLACE_BLOCK)
    {
      Line * lp = get_buffer_pt (cur_bp).p;
      size_t n = get_buffer_pt (cur_bp).n;

      if (n > pt.n)
        do
          lp = get_line_prev (lp);
        while (--n > pt.n);
      else if (n < pt.n)
        do
          lp = get_line_next (lp);
        while (++n < pt.n);

      pt.p = lp;
      up->block.osize = osize;
      up->block.size = size;
      up->block.text = copy_text_block (pt, osize);
    }

  up->next = get_buffer_last_undop (cur_bp);
  set_buffer_last_undop (cur_bp, up);

  if (!doing_undo)
    set_buffer_next_undop (cur_bp, up);
}