def test_resizing_window(self): lines = [u'$rw', u'>1 + 1', u'usually 2', u'>2 + 2', u'notquite 4', u'>3', u'3', u'>'] termstate = terminal_dsl.TerminalState( lines=lines, cursor_line=7, cursor_offset=1, width=11, height=6, history_height=3) with UndoScenario(termstate) as t: UndoScenario.initialize(t, termstate) tmux.stepwise_resize_width(t, 11) self.assertEqual(tmux.all_contents(t), lines)
def test_resize(self): """lines and cursor pos wrap, reported by line The front of the current line retains its position!""" with tmux.TmuxPane(10, 10) as t: self.assertEqual(tmux.cursor_pos(t), (0, 1)) tmux.send_command(t, 'true 123456789') self.assertEqual(tmux.visible(t), ['$true 1234', '56789', '$']) self.assertEqual(tmux.cursor_pos(t), (2, 1)) t.set_width(5) self.assertEqual(tmux.cursor_pos(t), (2, 1)) self.assertEqual(tmux.visible_after_prompt(t), [' 1234', '56789', '$']) tmux.stepwise_resize_width(t, 20) tmux.stepwise_resize_height(t, 20)
def resize(self, before, after, t): tmux.stepwise_resize_width(t, after.width) tmux.stepwise_resize_height(t, after.height)