mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-19 09:21:30 +03:00
Context: add methods bool has_{buffer,window)
This commit is contained in:
parent
6579b43ffb
commit
959ec46a16
@ -1,11 +1,12 @@
|
||||
#ifndef context_hh_INCLUDED
|
||||
#define context_hh_INCLUDED
|
||||
|
||||
#include "window.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
class Buffer;
|
||||
class Window;
|
||||
|
||||
struct Context
|
||||
{
|
||||
Context()
|
||||
@ -21,12 +22,15 @@ struct Context
|
||||
throw runtime_error("no buffer in context");
|
||||
return *m_buffer;
|
||||
}
|
||||
bool has_buffer() const { return m_buffer; }
|
||||
|
||||
Window& window() const
|
||||
{
|
||||
if (not m_window)
|
||||
throw runtime_error("no window in context");
|
||||
return *m_window;
|
||||
}
|
||||
bool has_window() const { return m_window; }
|
||||
public:
|
||||
Window* m_window;
|
||||
Buffer* m_buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user