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

tstack / lnav / 17589970077-2502

09 Sep 2025 05:00PM UTC coverage: 65.196% (-5.0%) from 70.225%
17589970077-2502

push

github

tstack
[format] add fields for source file/line

Knowing the source file/line context in a log
message can help find log messages when using
log2src.

56 of 70 new or added lines in 2 files covered. (80.0%)

13954 existing lines in 210 files now uncovered.

45516 of 69814 relevant lines covered (65.2%)

404154.37 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 <optional>
36
#include <string>
37
#include <vector>
38

39
#include "base/attr_line.hh"
40
#include "file_collection.hh"
41
#include "plain_text_source.hh"
42
#include "textview_curses.hh"
43

44
class files_sub_source
45
    : public text_sub_source
46
    , public list_input_delegate
47
    , public text_delegate {
48
public:
UNCOV
49
    bool empty() const override { return false; }
×
50

51
    bool list_input_handle_key(listview_curses& lv, const ncinput& ch) override;
52

53
    void list_input_handle_scroll_out(listview_curses& lv) override;
54

55
    size_t text_line_count() override;
56

57
    size_t text_line_width(textview_curses& curses) override;
58

59
    line_info text_value_for_line(textview_curses& tc,
60
                                  int line,
61
                                  std::string& value_out,
62
                                  line_flags_t flags) override;
63

64
    void text_attrs_for_line(textview_curses& tc,
65
                             int line,
66
                             string_attrs_t& value_out) override;
67

68
    size_t text_size_for_line(textview_curses& tc,
69
                              int line,
70
                              line_flags_t raw) override;
71

72
    bool text_handle_mouse(textview_curses& tc,
73
                           const listview_curses::display_line_content_t&,
74
                           mouse_event& me) override;
75

76
    void text_selection_changed(textview_curses& tc) override;
77

78
    size_t fss_last_line_len{0};
79
    attr_line_t fss_curr_line;
80
    std::chrono::microseconds fss_details_mtime;
81
    plain_text_source* fss_details_source{nullptr};
82
};
83

84
struct files_overlay_source : list_overlay_source {
85
    bool list_static_overlay(const listview_curses& lv,
86
                             int y,
87
                             int bottom,
88
                             attr_line_t& value_out) override;
89
};
90

91
namespace files_model {
92

93
struct no_selection {};
94

95
template<typename C, typename T>
96
struct selection_base {
97
    int sb_index{0};
98
    T sb_iter;
99

100
    static C build(int index, T iter)
101
    {
UNCOV
102
        C retval;
×
103

UNCOV
104
        retval.sb_index = index;
×
UNCOV
105
        retval.sb_iter = iter;
×
UNCOV
106
        return retval;
×
UNCOV
107
    }
×
108
};
109

110
struct error_selection
111
    : selection_base<error_selection, std::pair<std::string, std::string>> {};
112

113
struct other_selection
114
    : selection_base<other_selection,
115
                     std::map<std::string, other_file_descriptor>::iterator> {};
116

117
struct file_selection
118
    : selection_base<file_selection,
119
                     std::vector<std::shared_ptr<logfile>>::iterator> {};
120

121
using files_list_selection = mapbox::util::
122
    variant<no_selection, error_selection, other_selection, file_selection>;
123

124
files_list_selection from_selection(std::optional<vis_line_t> sel_vis);
125

126
}  // namespace files_model
127

128
#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