~ubuntu-branches/ubuntu/precise/vte/precise

« back to all changes in this revision

Viewing changes to src/vteseq.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-06-16 17:59:49 UTC
  • mfrom: (1.1.65 upstream) (3.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110616175949-dexr6gu2dxiifi00
Tags: 1:0.28.1-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Add 93_add_alt_screen_scroll_toggle.patch: Handle scrolling differently
    when using alternate screen or scrolling is restricted.
  - Add lp246701_scroll_region_updates.patch: Bug fix. (LP #246701)
  - 91_keep_fds.patch:
    vte-2.90 does not yet support G_SPAWN_LEAVE_DESCRIPTORS_OPEN
    when calling vte_terminal_fork_command_full() until that is
    fixed we need to keep this patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
532
532
 
533
533
/* Call another function a given number of times, or once. */
534
534
static void
535
 
vte_sequence_handler_multiple(VteTerminal *terminal,
536
 
                              GValueArray *params,
537
 
                              VteTerminalSequenceHandler handler)
 
535
vte_sequence_handler_multiple_limited(VteTerminal *terminal,
 
536
                                      GValueArray *params,
 
537
                                      VteTerminalSequenceHandler handler,
 
538
                                      glong max)
538
539
{
539
540
        long val = 1;
540
541
        int i;
544
545
                value = g_value_array_get_nth(params, 0);
545
546
                if (G_VALUE_HOLDS_LONG(value)) {
546
547
                        val = g_value_get_long(value);
547
 
                        val = MAX(val, 1);      /* FIXME: vttest. */
 
548
                        val = CLAMP(val, 1, max);       /* FIXME: vttest. */
548
549
                }
549
550
        }
550
551
        for (i = 0; i < val; i++)
551
552
                handler (terminal, NULL);
552
553
}
553
554
 
 
555
static void
 
556
vte_sequence_handler_multiple(VteTerminal *terminal,
 
557
                              GValueArray *params,
 
558
                              VteTerminalSequenceHandler handler)
 
559
{
 
560
        vte_sequence_handler_multiple_limited(terminal, params, handler, G_MAXLONG);
 
561
}
 
562
 
 
563
static void
 
564
vte_sequence_handler_multiple_r(VteTerminal *terminal,
 
565
                                GValueArray *params,
 
566
                                VteTerminalSequenceHandler handler)
 
567
{
 
568
        vte_sequence_handler_multiple_limited(terminal, params, handler,
 
569
                                              terminal->column_count - terminal->pvt->screen->cursor_current.col);
 
570
}
554
571
 
555
572
/* Manipulate certain terminal attributes. */
556
573
static void
1570
1587
static void
1571
1588
vte_sequence_handler_IC (VteTerminal *terminal, GValueArray *params)
1572
1589
{
1573
 
        vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_ic);
 
1590
        vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_ic);
1574
1591
}
1575
1592
 
1576
1593
/* Begin insert mode. */