/* Commandes d'edition */ /* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "edit.h" #include "output.h" #include "line.h" void begin_editing(const char *prompt, struct linebuf_struct *linebuf) { begin_output(prompt); line_set(linebuf); } void replace_region_with_char(int start, int end, char c) { output_replace_region_with_char(start, end, c); line_replace_region_with_char(start, end, c); } void replace_region_with_text(int start, int end, const char *text) { output_replace_region_with_text(start, end, text); line_replace_region_with_text(start, end, text); } void erase_region(int start, int end) { output_erase_region(start, end); line_erase_region(start, end); } void delete_region(int start, int end) { output_delete_region(start, end); line_delete_region(start, end); } void move_to(int newpoint) { output_move_cursor(newpoint); line_set_point(newpoint); } void set_mark(int newmark) { line_set_mark(newmark); } void exchange_point_and_mark() { int tmp; output_move_cursor(mark); tmp = point; line_set_point(mark); line_set_mark(tmp); } void clear_screen() { output_clear_screen_and_reprint(); } void refresh_line() { output_clear_line_and_reprint(); } void reset_line(struct linebuf_struct *linebuf) { output_replace_region_with_text(0, line_end, linebuf->buf); line_set(linebuf); } void accept_line() { output_new_line(); } void abort_line() { output_new_line(); line_delete_region(0, line_end); } void discard_line() { line_discard(); } void end_editing() { end_output(); line_release(); }