• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tstack / lnav / 20284884426-2753

16 Dec 2025 10:23PM UTC coverage: 68.23% (-0.7%) from 68.903%
20284884426-2753

push

github

tstack
[log] show invalid utf hex dump in log view too

25 of 25 new or added lines in 2 files covered. (100.0%)

503 existing lines in 33 files now uncovered.

51170 of 74996 relevant lines covered (68.23%)

433797.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/files_sub_source.hh
1
/**
2
 * Copyright (c) 2020, Timothy Stack
3
 *
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions are met:
8
 *
9
 * * Redistributions of source code must retain the above copyright notice, this
10
 * list of conditions and the following disclaimer.
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 * this list of conditions and the following disclaimer in the documentation
13
 * and/or other materials provided with the distribution.
14
 * * Neither the name of Timothy Stack nor the names of its contributors
15
 * may be used to endorse or promote products derived from this software
16
 * without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29

30
#ifndef files_sub_source_hh
31
#define files_sub_source_hh
32

33
#include <chrono>
34
#include <map>
35
#include <memory>
36
#include <optional>
37
#include <string>
38
#include <vector>
39

40
#include "base/attr_line.hh"
41
#include "base/lnav.console.hh"
42
#include "file_collection.hh"
43
#include "mapbox/variant.hpp"
44
#include "plain_text_source.hh"
45
#include "textview_curses.hh"
46

47
class files_sub_source
48
    : public text_sub_source
49
    , public list_input_delegate
50
    , public text_delegate {
51
public:
52
    bool empty() const override { return false; }
×
53

54
    bool list_input_handle_key(listview_curses& lv, const ncinput& ch) override;
55

56
    void list_input_handle_scroll_out(listview_curses& lv) override;
57

58
    size_t text_line_count() override;
59

60
    size_t text_line_width(textview_curses& curses) override;
61

62
    line_info text_value_for_line(textview_curses& tc,
63
                                  int line,
64
                                  std::string& value_out,
65
                                  line_flags_t flags) override;
66

67
    void text_attrs_for_line(textview_curses& tc,
68
                             int line,
69
                             string_attrs_t& value_out) override;
70

71
    size_t text_size_for_line(textview_curses& tc,
72
                              int line,
73
                              line_flags_t raw) override;
74

75
    bool text_handle_mouse(textview_curses& tc,
76
                           const listview_curses::display_line_content_t&,
77
                           mouse_event& me) override;
78

79
    void text_update_marks(vis_bookmarks& bm) override;
80

81
    void text_selection_changed(textview_curses& tc) override;
82

83
    size_t fss_last_line_len{0};
84
    attr_line_t fss_curr_line;
85
    std::chrono::microseconds fss_details_mtime;
86
    plain_text_source* fss_details_source{nullptr};
87
};
88

89
struct files_overlay_source : list_overlay_source {
90
    bool list_static_overlay(const listview_curses& lv,
91
                             media_t media,
92
                             int y,
93
                             int bottom,
94
                             attr_line_t& value_out) override;
95
};
96

97
namespace files_model {
98

99
struct no_selection {};
100

101
template<typename C, typename T>
102
struct selection_base {
103
    int sb_index{0};
104
    T sb_iter;
105

106
    static C build(int index, T iter)
107
    {
UNCOV
108
        C retval;
×
109

UNCOV
110
        retval.sb_index = index;
×
UNCOV
111
        retval.sb_iter = iter;
×
UNCOV
112
        return retval;
×
113
    }
×
114
};
115

116
struct stub_selection
117
    : selection_base<stub_selection,
118
                     std::pair<std::string, lnav::console::user_message>> {};
119

120
struct other_selection
121
    : selection_base<other_selection,
122
                     std::map<std::string, other_file_descriptor>::iterator> {};
123

124
struct file_selection
125
    : selection_base<file_selection,
126
                     std::vector<std::shared_ptr<logfile>>::iterator> {};
127

128
using files_list_selection = mapbox::util::
129
    variant<no_selection, stub_selection, other_selection, file_selection>;
130

131
files_list_selection from_selection(std::optional<vis_line_t> sel_vis);
132

133
}  // namespace files_model
134

135
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc