diff --git a/configure b/configure index bd9519cd..ed3bac80 100755 --- a/configure +++ b/configure @@ -3628,7 +3628,15 @@ if test "${enable_static+set}" = set; then : fi if test x"${enable_static}" != x"no"; then + case "$host_os" in + darwin*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"static linking is not supported on $host_os\"" >&5 +$as_echo "$as_me: WARNING: \"static linking is not supported on $host_os\"" >&2;} + ;; + *) STATIC_LDFLAGS="$STATIC_LDFLAGS -static" + ;; + esac fi diff --git a/configure.in b/configure.in index ab40f0eb..a5f04d13 100644 --- a/configure.in +++ b/configure.in @@ -31,7 +31,14 @@ AC_ARG_ENABLE([static], AS_HELP_STRING([--disable-static], [Disable static linking])) if test x"${enable_static}" != x"no"; then + case "$host_os" in + darwin*) + AC_WARN("static linking is not supported on $host_os") + ;; + *) STATIC_LDFLAGS="$STATIC_LDFLAGS -static" + ;; + esac fi AC_SUBST(STATIC_LDFLAGS) diff --git a/src/termios_guard.hh b/src/termios_guard.hh index aeae4cc7..3a6a71f6 100644 --- a/src/termios_guard.hh +++ b/src/termios_guard.hh @@ -1,18 +1,33 @@ +/** + * @file termios_guard.hh + */ #ifndef __termios_guard_hh #define __termios_guard_hh +/** + * RAII class that saves the current termios for a tty and then restores them + * during destruction. + */ class guard_termios { public: - guard_termios(int fd) : gt_fd(fd) { - + /** + * Store the TTY termios settings in this object. + * + * @param fd The tty file descriptor. + */ + guard_termios(const int fd) : gt_fd(fd) { if (isatty(this->gt_fd) && tcgetattr(this->gt_fd, &this->gt_termios) == -1) { perror("tcgetattr"); } }; - + + /** + * Restore the TTY termios settings that were captured when this object was + * instantiated. + */ ~guard_termios() { if (isatty(this->gt_fd) && tcsetattr(this->gt_fd, TCSANOW, &this->gt_termios) == -1) { @@ -21,7 +36,7 @@ public: }; private: - int gt_fd; + const int gt_fd; struct termios gt_termios; }; diff --git a/src/textview_curses.cc b/src/textview_curses.cc index e3b6adbf..021972a8 100644 --- a/src/textview_curses.cc +++ b/src/textview_curses.cc @@ -189,7 +189,7 @@ void textview_curses::listview_value_for_row(const listview_curses &lv, vis_line_t row, attr_line_t &value_out) { - bookmark_vector &bv = this->tc_bookmarks[&BM_USER]; + bookmark_vector &user_marks = this->tc_bookmarks[&BM_USER]; string_attrs_t &sa = value_out.get_attrs(); string &str = value_out.get_string(); highlight_map_t::iterator iter; @@ -229,14 +229,14 @@ void textview_curses::listview_value_for_row(const listview_curses &lv, } if (lr.lr_end > lr.lr_start) { - sa[lr].insert(make_string_attr("style", iter->second. - get_attrs(hcount))); - hcount++; - - off = matches[1]; + sa[lr].insert(make_string_attr("style", iter->second. + get_attrs(hcount))); + hcount++; + + off = matches[1]; } else { - off += 1; + off += 1; } } else { @@ -245,9 +245,9 @@ void textview_curses::listview_value_for_row(const listview_curses &lv, } } - if (binary_search(bv.begin(), bv.end(), row)) { + if (binary_search(user_marks.begin(), user_marks.end(), row)) { + struct line_range lr = { 0, -1 }; string_attrs_t::iterator iter; - bool added = false; for (iter = sa.begin(); iter != sa.end(); iter++) { attrs_map_t &am = iter->second; @@ -256,15 +256,10 @@ void textview_curses::listview_value_for_row(const listview_curses &lv, for (am_iter = am.begin(); am_iter != am.end(); am_iter++) { if (am_iter->first == "style") { am_iter->second.sa_int ^= A_REVERSE; - added = true; - break; } } } - if (!added) { - struct line_range lr = { 0, -1 }; - - sa[lr].insert(make_string_attr("style", A_REVERSE)); - } + + sa[lr].insert(make_string_attr("style", A_REVERSE)); } } diff --git a/src/textview_curses.hh b/src/textview_curses.hh index 2b393600..d0d31525 100644 --- a/src/textview_curses.hh +++ b/src/textview_curses.hh @@ -1,3 +1,7 @@ +/** + * @file textview_curses.hh + */ + #ifndef __textview_curses_hh #define __textview_curses_hh @@ -32,6 +36,10 @@ public: virtual void text_user_mark(int line, bool added) { }; }; +/** + * The textview_curses class adds user bookmarks and searching to the standard + * list view interface. + */ class textview_curses : public listview_curses, public list_data_source,