Changeset 371bd7d in mainline for uspace/app/edit


Ignore:
Timestamp:
2010-03-27T09:22:17Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
36a75a2
Parents:
cd82bb1 (diff), eaf22d4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
uspace/app/edit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/edit/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = edit
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        edit.c \
     35        sheet.c
    3336
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     37include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/edit/edit.c

    rcd82bb1 r371bd7d  
    9898static bool done;
    9999static pane_t pane;
     100static bool cursor_visible;
    100101
    101102static int scr_rows, scr_columns;
     
    108109/** Maximum filename length that can be entered. */
    109110#define INFNAME_MAX_LEN 128
     111
     112static void cursor_show(void);
     113static void cursor_hide(void);
     114static void cursor_setvis(bool visible);
    110115
    111116static void key_handle_unmod(console_event_t const *ev);
     
    199204
    200205        /* Initial display */
     206        cursor_visible = true;
     207
     208        cursor_hide();
    201209        console_clear(con);
    202210        pane_text_display();
     
    205213                status_display("File not found. Starting empty file.");
    206214        pane_caret_display();
    207 
     215        cursor_show();
    208216
    209217        done = false;
     
    230238                /* Redraw as necessary. */
    231239
     240                cursor_hide();
     241
    232242                if (pane.rflags & REDRAW_TEXT)
    233243                        pane_text_display();
     
    238248                if (pane.rflags & REDRAW_CARET)
    239249                        pane_caret_display();
     250
     251                cursor_show();
    240252        }
    241253
     
    243255
    244256        return 0;
     257}
     258
     259static void cursor_show(void)
     260{
     261        cursor_setvis(true);
     262}
     263
     264static void cursor_hide(void)
     265{
     266        cursor_setvis(false);
     267}
     268
     269static void cursor_setvis(bool visible)
     270{
     271        if (cursor_visible != visible) {
     272                console_cursor_visibility(con, visible);
     273                cursor_visible = visible;
     274        }
    245275}
    246276
     
    445475static void file_save_as(void)
    446476{
    447         char *old_fname, *fname;
    448         int rc;
    449 
    450         old_fname = (doc.file_name != NULL) ? doc.file_name : "";
     477        const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
     478        char *fname;
     479       
    451480        fname = filename_prompt("Save As", old_fname);
    452481        if (fname == NULL) {
     
    455484        }
    456485
    457         rc = file_save(fname);
     486        int rc = file_save(fname);
    458487        if (rc != EOK)
    459488                return;
     
    688717        wchar_t c;
    689718        size_t pos, size;
    690         unsigned s_column;
     719        int s_column;
    691720        coord_t csel_start, csel_end, ctmp;
    692721
     
    736765                s_column = pane.sh_column;
    737766                while (pos < size) {
    738                         if (csel_start.row == rbc.row && csel_start.column == s_column) {
     767                        if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) {
    739768                                fflush(stdout);
    740769                                console_set_color(con, COLOR_BLACK, COLOR_RED, 0);
     
    742771                        }
    743772       
    744                         if (csel_end.row == rbc.row && csel_end.column == s_column) {
     773                        if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    745774                                fflush(stdout);
    746775                                console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     
    762791                }
    763792
    764                 if (csel_end.row == rbc.row && csel_end.column == s_column) {
     793                if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    765794                        fflush(stdout);
    766795                        console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     
    789818        spt_t caret_pt;
    790819        coord_t coord;
    791         char *fname;
    792         int n;
    793820
    794821        tag_get_pt(&pane.caret_pos, &caret_pt);
    795822        spt_get_coord(&caret_pt, &coord);
    796823
    797         fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>";
     824        const char *fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>";
    798825
    799826        console_goto(con, 0, scr_rows - 1);
    800827        console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0);
    801         n = printf(" %d, %d: File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
     828        int n = printf(" %d, %d: File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
    802829            "Ctrl-E Save As", coord.row, coord.column, fname);
    803830        printf("%*s", scr_columns - 1 - n, "");
  • uspace/app/edit/sheet.c

    rcd82bb1 r371bd7d  
    5050
    5151#include <stdlib.h>
    52 #include <string.h>
     52#include <str.h>
    5353#include <errno.h>
    5454#include <adt/list.h>
Note: See TracChangeset for help on using the changeset viewer.